/*---------------------------------------------------------------------- File : simple.c Contents: a very simple C program Author : Christian Borgelt History : 14.05.1998 file created ----------------------------------------------------------------------*/ #include int main (void) { /* --- main function */ int a, b, c; /* the numbers to read */ int max; /* the maximum of the numbers */ printf("Give me three numbers:\n"); scanf("%i%i%i", &a, &b, &c); /* read input from terminal */ printf("sum : %i\n", a +b +c); /* print sum, */ printf("product: %i\n", a *b *c); /* product, */ printf("average: %f\n", (a +b +c) /3.0); /* and average */ max = a; /* determine the maximum */ if (b > max) max = b; /* of the three numbers */ if (c > max) max = c; /* a, b, and c */ printf("maximum: %i\n", max); /* and print it */ return 0; /* return 'ok' */ } /* main() */