Program to display first 10 natural no. & their sum.

C Programming Language Loop control in C Language (Article) Loop control in C Language (Program)

4254

Program:

/* Program to display first 10 natural no. & their sum.
  Author: Atnyla Developer */
#include<stdio.h>
#include<conio.h>
void main()
{
int i,sum=0;
 
for(i=1;i<=10;i++)
{
	printf("%d no is= %d\n",i,i);
	sum=sum+i;
}
	printf("sum =%d",sum);
}

Output:

1 no is= 1
2 no is= 2
3 no is= 3
4 no is= 4
5 no is= 5
6 no is= 6
7 no is= 7
8 no is= 8
9 no is= 9
10 no is= 10
sum =55 

Explanation:

Program to display first 10 natural no. & their sum.

This Particular section is dedicated to Programs only. If you want learn more about C Programming Language. Then you can visit below links to get more depth on this subject.