Write a c program to find the sum of odd numbers and sum of even numbers from 1 to n
Answers
Answered by
2
Answer:
#include<stdio. h>
#include<conio. h>
void main()
{
int num, i;
int sum=0;
clrscr();
printf("enter the number");
scanf("%d", &num);
for(i=0; i<=num; i++)
{
for ( j=0; j<=n; j++)
{
if((i/2)==0)
{
sum=sum+i;
printf("%d is even");
}
else
{
sum=sum+j;
printf ("%d is odd");
}
getch();
}
Similar questions
Physics,
5 months ago
India Languages,
5 months ago
Hindi,
5 months ago
Science,
1 year ago
Science,
1 year ago