Users Online

· Guests Online: 141

· Members Online: 0

· Total Members: 188
· Newest Member: meenachowdary055

Forum Threads

Newest Threads
No Threads created
Hottest Threads
No Threads created

Latest Articles

40 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.
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);
}

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

Comments

No Comments have been Posted.

Post Comment

Please Login to Post a Comment.

Ratings

Rating is available to Members only.

Please login or register to vote.

No Ratings have been Posted.
Render time: 1.59 seconds
10,813,550 unique visits