Answers for "c program for calculating product of array"

C
0

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);
}
Posted by: Guest on April-28-2022

Code answers related to "c program for calculating product of array"

Code answers related to "C"

Browse Popular Code Answers by Language