C Programming

# C – Find Sum of N Integer Numbers Using the Function

Write a c program to find the sum of the N integer numbers using the fuctions.

#include <stdio.h>

#include <conio.h>

int sum (int number);

void main()

{

int n;

printf("How many number : ");

scanf("%d", &n);

printf("sum the %d numbers is : %d ",n,sum(n));

getch();

}

int sum(int number){

int i, add=0;

for(i=1; i<=number; i++){

add+=i;

}

return add;

}