1
5.1kviews
Write a program to calculate sum of list by passing array to a function.
1 Answer
0
313views

Program code:

#include<stdio.h>
#include<conio.h>
int main() 
{
    int addition (int a[], int n);
    int n, i, a[100], sum;
    printf("Enter the number of elements:");
    scanf("%d", &n);
for (i=0; i<=n-1; i++)  
{
    printf("Enter a value:");
    scanf("%d", &a[i]);
    }
    sum = addition(a,n);
    printf("The Sum is %d", sum);
    getch();
}
int addition (int a[], …

Create a free account to keep reading this post.

and 5 others joined a min ago.

Please log in to add an answer.