// 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 find the person is eligible for voting or not.
//A C program to find largest number among 3.
// A C program to perform arithmetic operations using switch case.
//A C program to find largest number among 3.
// A C program to perform arithmetic operations using switch case.
Nhận xét
Đăng nhận xét