You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
/*
|
|
* C program to find the sum of first 50 natural numbers
|
|
* using for loop
|
|
*/
|
|
#include <stdio.h>
|
|
|
|
void main()
|
|
{
|
|
int num, sum = 0;
|
|
for (num = 1; num <= 50; num++)
|
|
{
|
|
sum = sum + num;
|
|
}
|
|
printf("Sum = %4d\n", sum);
|
|
} |