SUM THE FIRST 50 EVEN NATURAL NUMBERS

/*PROGRAM TO SUM THE FIRST 50 EVEN NATURAL NUMBERS*/
#include<stdio.h>
main()
{
int sum=0,i=2;
while(i<=100)
{
sum+i;
i+=2;
}
printf("Sum of first 50 even natural numbers=%d
",sum);

getch();
}

OUTPUT
Sum of first 50 natural numbers=2550


Related Posts by Categories

0 comments:

Post a Comment

Blog Archive

Powered by Blogger.