Answer:
#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);
}
Within a loop
Step 1: Initialize a variable to 1 (say x=1)
Step 2: Specifiy the condition
In this case x<=10
Step 3: Increment the variable by 1
using increment operator x++
OR
simply x+=1(x=x+1)
Step 4: Print the value of variable
Terminate the loop
Step-by-step explanation: