710 views
3 votes
Given 3 integers, output their average and their product, using integer arithmetic. Ex: If the input is: 10 20 5 the output is: 11 1000 Note: Integer division discards the fraction. Hence the average of 10 20 5 is output as 11, not 11.666666666666666. Note: The test cases include three very large input values whose product results in overflow. You do not need to do anything special, but just observe that the output does not represent the correct product (in fact, three positive numbers yield a negative output; wow). Submit the above for grading.

1 Answer

0 votes

Answer:

#include<stdio.h>

void main(){

int a,b,c,product,average;

printf("Enter 3 intgeres");

scanf("%d%d%d",&a,&b,&c);

product=a*b*c;

average=(a+b+c)/3;

printf("Product is %d",product);

printf("Average is %d",average);

}

Step-by-step explanation:

Here we are reading 3 integers and finding their average and product using integer athematic and printing the same using printf statement.

User Arkiliknam
by
5.3k points