#include<stdio.h> 

int main()
{
     
    int sum=0,n,i=0;
    printf("Enter n\n");
    scanf("%d",&n);
     
    for(i=1; i<=n; i++)
    {
        sum=sum+i;
    }
     
     
    printf("Sum of %d natural numbers is %d",n,sum);
     
    return 0;
}
     
           
Note: Need to be arranged in compiler after copied
   

 OutPut:

Enter n 4 Sum of 4 natural numbers is 10