C/Max Min.c
2024-05-13 11:09:46 -05:00

29 lines
474 B
C

#include <stdio.h>
#include <stdlib.h>
int main() {
float n1, n2; /* Numbers */
/* Prompt the user */
printf("Enter a number: ");
scanf("%f", &n1);
printf("Enter another number: ");
scanf("%f", &n2);
/* Find and print the maximum and minimum numbers */
if (n1 >= n2) {
printf("The maximum is %.2f.\n", n1);
printf("The minimum is %.2f.\n", n2);
} else {
printf("The maximum is %.2f.\n", n2);
printf("The minimum is %.2f.\n", n1);
}
return 0;
}