ProAnswers.org

Write a C program to find out the Sum of N Numbers ?

#include

#include 

void main() 

{ 

int n,sum=0; 

clrscr(); 

printf(“

enter the value of n
”);

scanf(“%d”,&n); 

for(i=1;i<=n;i++) 

{ 

sum=sum+i; 

} 

printf(“sum=%d

”,sum);

getch(); 

} 

Output: 

enter the value of n 

10 

sum=55