Program
#include <stdio.h> int main() { printf("***********************************************************"); printf("\n************************************************************"); printf("\n** WAP to find Product of elements of an array **"); printf("\n** Created by Sheetal Garg **"); printf("\n** Assistant Professor **"); printf("\n** Phone No:9467863365 **"); printf("\n************************************************************"); printf("\n************************************************************\n"); int n,i,a[5],prod=1; printf("Enter no. of elements in the arrayn"); scanf("%d",&n); printf("enter array elements"); for(i=0;i<n;i++) scanf("%d",&a[i]); for(i=0; i<n; i++) prod=prod * a[i]; printf("Product of elements of array is %d",prod); return 0; }
Output
*************************************************************************** *************************************************************************** ** WAP to find Product of elements of an array ** ** Created by Sheetal Garg ** ** Assistant Professor ** ** Phone No:9467863365 ** *************************************************************************** *************************************************************************** Enter no. of elements in the array 4 enter array elements 4 2 1 5 Product of elements of array is 30