To compute the sum of natural numbers from 1 to n (entered by the user) here for loop is used.

Code Block :

https://github.com/aksprogramming/c-programming/blob/master/sumofn.c