Here is source code of the C program to find the sum of first 50 natural numbers using for loop. The C program is successfully compiled and run on a Linux system. The program output is also shown below.
* C program to find the sum of first 50 natural numbers
* using for loop
int num, sum = 0;
for (num = 1; num <= 50; num++)
sum = sum + num;
printf("Sum = %4d\n", sum);
$ cc pgm73.c $ a.out Sum = 1275
Sanfoundry Global Education & Learning Series – 1000 C Programs.