Beta Coder

Learn code like Beta Coder.

Breaking

Tuesday, September 29, 2020

C Program to Display First 10 Natural Numbers and Their Sum

Display First 10 Natural Numbers and Their Sum

C Program to Display First 10 Natural Numbers and Their Sum
In this program we learn how to display first 10 natural numbers and their sum by using C.
C program to display first 10 natural numbers and their sum
// Display First 10 Natural Numbers and Their Sum
#include<stdio.h>
#include<conio.h>
void main()
{
	int i, sum = 0;
	clrscr();
	for(i = 1; i <= 10; i++)
	{
		sum = sum + i;
	}
	printf("\n The sum of first natural numbers = %d", sum);
	getch();
}	
OUTPUT:
   The sum of first natural numbers = 55

1 comment:

  1. Write a c# program to find sum of First ten natural numbers using statement lambda

    ReplyDelete