This is a C Program to find the sum of first 50 natural numbers using for loop.

This C Program finds sum of first 50 natural numbers using for loop.

It displays the sum of first 50 natural numbers as output.

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 */ #include <stdio.h> void main() { int num, sum = 0; for (num = 1; num <= 50; num++) { sum = sum + num; } printf("Sum = %4d\n", sum); }

In this C program, we are reading the sum of first 50 natural numbers using for loop. By initializing the value of ‘num’ variable as 1 and checks the condition that ‘num’ variable value is less than or equal to 50. If the condition is true then we are computing the summation of the value of ‘sum’ variable with the value of ‘num’ variable. After that, we are displaying the sum of first 50 natural numbers as output.

$ cc pgm73.c $ a.out Sum = 1275

**Sanfoundry Global Education & Learning Series – 1000 C Programs.**

Here’s the list of Best Books in C Programming, Data-Structures and Algorithms

**Related Posts:**

- Practice BCA MCQs
- Check C Books
- Apply for Computer Science Internship
- Watch Advanced C Programming Videos
- Apply for C Internship