Created
March 22, 2020 13:59
-
-
Save racterub/fdb23a61391c3d08dfb9a2ebfd783a3b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
int main(int argc, char *argv[]) | |
{ | |
int a,b,c,sum,product,min,max; | |
float avg; | |
printf("Input a b c: "); | |
scanf("%d%d%d", &a, &b, &c); | |
//exception | |
if (a == 0 && b == 0 && c == 0) return 0; | |
//avg | |
avg = (a + b + c) / 3; | |
//product | |
product = a * b * c; | |
//min | |
min = a; | |
if (b < min) { | |
min = b; | |
} | |
if (c < min) { | |
min = c; | |
} | |
//sum | |
sum = a + b + c; | |
//max | |
max = a; | |
if (b > max) { | |
max = b; | |
} | |
if (c > max) { | |
max = c; | |
} | |
printf("a: %d, b: %d, c: %d\n", a, b, c); | |
printf("Avg: %.2f\n", avg); | |
printf("Product: %d\n", product); | |
printf("Min: %d\n", min); | |
printf("Max: %d\n", max); | |
printf("SUM: %d\n", sum); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment