Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR C

c program for calculating product of array

//Product of integers in an array

#include <stdio.h>
#include <stdlib.h>

int main()
{
    int a[1000],i,sum=1,n;

    printf("Enter the size of array: ");
    scanf("%d", &n);

    printf("Enter the items in the array: ");
    for (i = 0; i < n; i++)
    {
        scanf("%d", &a[i]);
    }

    for(i = 0; i < n; i++)
    {
        sum *= a[i];
    }
    printf("The product of your array is %d", sum);
}
 
PREVIOUS NEXT
Tagged: #program #calculating #product #array
ADD COMMENT
Topic
Name
4+6 =