Example-
array is {4,5,3,2,1}
prodcut of all elements are 120
program-
#include< stdio.h>
int main()
{
int a[100],n,i,ans=1;
printf("Number of element in array ?\n");
scanf("%d",&n);
printf("Enter %d number in array\n",n);
for(i=0;i< n;i++)
scanf("%d",&a[i]);
//Now calculate the product
for(i=0;i< n;i++)
ans=ans*a[i];
printf("Product of all number in array is %d",ans);
}
Number of element in array ?
4
Enter 4 number in array
1 2 3 4
Product of all number in array is 24