Program to display first 10 natural no. & their sum

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

Print nimber 1 2 3 4 5 6 7 8 9 10 and sum of all number 1+2+3+4+5+6+7+8+9+10

#include<stdio.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 is =%d",sum);
}

Related Posts