Skip to content

Instantly share code, notes, and snippets.

@racterub
Created March 22, 2020 13:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save racterub/fdb23a61391c3d08dfb9a2ebfd783a3b to your computer and use it in GitHub Desktop.
Save racterub/fdb23a61391c3d08dfb9a2ebfd783a3b to your computer and use it in GitHub Desktop.
#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