| control/max-prog.c - Et program som beregner det største af to doubles - coding style. | Lektion 3 - slide 17 : 25 Program 1 |
#include <stdio.h>
int main(void) {
double x, y, max;
printf("Enter two real numbers: ");
scanf("%lf %lf", &x, &y);
/* Find the maximum of x and y */
if (x < y)
max = y;
else
max = x;
printf("The maximum of x and y is %12.8f\n", max);
return 0;
}