Write a program sum of first n natural numbers in C.
#include<stdio.h> void main () { int i,n ,sum= 0; scanf("%d",&n); printf("The first 7 natural is:",n); for(int i=1;i<=7;i++) { printf("%d ",i); sum=sum+i; } printf("\nThe Sum of Natural Number upto 7 terms : %d",sum); return 0; }
Can you be more specific about the content of your article? After reading it, I still have some doubts. Hope you can help me.