Computer Science, asked by Raaj3229, 9 months ago

Write a c program to find the sum of odd numbers and sum of even numbers from 1 to n

Answers

Answered by raginimishra08082001
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