C program to find the sum of n integer numbers using function

C program to find the sum of n integer numbers using function, Write a program to find the sum of 'n' integer numbers using function. Write a c program to find the sum of 'n' entered integer numbers using function.

Write a program to find the sum of 'n' integer numbers using function.

Write a c program to find the sum of 'n' entered integer numbers using function.

C program to find the sum of n integer numbers using function

C Code


#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;
}

Output

C program to find the sum of n integer numbers using function

You May Also Like...

Socialize with Us