#include<stdio.h>
#include<conio.h>
void main()
{
int n,i,se=0,so=0;
puts("Enter the terms");
scanf("%d",&n);
for(i=1;i<=n;i++)
{
if(i%2==0)
se=se+i;
else so=so+i;
}
printf("From 1 to %d,\nSum of even numbers is %d\nSum of odd numbers is %d",n,se,so);
}
Comments
Post a Comment