PJC-0x03/minmax.c

40 lines
633 B
C
Raw Permalink Normal View History

2020-03-05 13:35:46 +01:00
#include <stdio.h>
#include "minmax.h"
#include "main.h"
int maximum()
{
int x, y, z;
printf("** printmax **\n");
printf("Zadejte 3 cisla oddelena mezerou: ");
2020-03-05 13:35:46 +01:00
scanf("%d%d%d", &x, &y, &z);
int max = x;
if ( y > max ) {
max = y;
}
if ( z > max ) {
max = z;
}
return max;
}
int minimum()
{
int selection, max, min = 0;
2020-03-05 13:35:46 +01:00
int x, y, z;
printf("** printmin **\n");
printf("Zadejte 3 cisla oddelena mezerou: ");
2020-03-05 13:35:46 +01:00
scanf("%d%d%d", &x, &y, &z);
min = x;
2020-03-05 13:35:46 +01:00
if ( y < min ) {
min = y;
}
if ( z < min ) {
min = z;
}
return min;
}