Program Description:

In this following program we will use the the concept of loop to find the sum of numbers from 1 to n, where n will be entered by the user.]

Source code:

#include<stdio.h>
int main()
{
int sum=0,i,n;
printf("Enter a number:");
scanf("%d",&n);
for(i=1;i<=n;i++)
sum=sum+i;
printf("The sum numbers from 1 to %d is %d",n,sum);
}


Output: