Starting Vocational Training From 1-May-2024 Get Detail
Write a C program to find the sum of first 10 natural numbers.
Expected Output :
The first 10 natural number is :
1 2 3 4 5 6 7 8 9 10
The Sum is : 55
???????
#include <stdio.h>
void main()
{
int j, sum = 0;
printf("The first 10 natural number is : ");
for (j = 1; j <= 10; j++)
{
sum = sum + j;
printf("%d ",j);
}
printf(" The Sum is : %d ", sum);
}