#include<stdio.h>
int main()
{
int sum=0,n,i=0;
printf("Enter n\n");
scanf("%d",&n);
abc :
i++;
sum=sum+i;
if(i<n)
{
goto abc;
}
printf("Sum of first %d natural numbers is %d",n,sum);
return 0;
}
Note: Need to be arranged in compiler after copied
OutPut:
Enter n
5
Sum of first 5 natural number is 15