A Program to calculate Sum, Product of all elements using array


// A Program to calculate Sum, Product of all elements using array

#include<stdio.h>
#include<conio.h> 
void main() 

clrscr();
int arr[10],sum,product,i; 
printf("\nEnter elements : \n"); 
for(i=0; i<10; i++) 
{
printf("Enter arr[%d] : ",i); 
scanf("%d",&arr[i]); 

sum=0;
product=1;
for(i=0; i<10; i++)
{
sum=sum+arr[i];
product=product*arr[i];
}
printf("\nSum of array is     : %d"  ,sum); 
printf("\nProduct of array is : %d\n",product); 
getch();
}


  Output:


A Program to calculate Sum, Product of all elements using array, my knowledge to you dude



















Post a Comment

0 Comments