44 lines
762 B
C
44 lines
762 B
C
|
#include <stdio.h>
|
||
|
#include "minmax.h"
|
||
|
#include "main.h"
|
||
|
|
||
|
int maximum()
|
||
|
{
|
||
|
int x, y, z;
|
||
|
printf("Zadejte 3 cisla oddelena mezerou: ");
|
||
|
printf("** printmax **\n");
|
||
|
|
||
|
scanf("%d%d%d", &x, &y, &z);
|
||
|
int max = x;
|
||
|
if ( y > max ) {
|
||
|
max = y;
|
||
|
}
|
||
|
if ( z > max ) {
|
||
|
max = z;
|
||
|
}
|
||
|
// pokud je y vetsi, ulozime jej do max
|
||
|
// pokud je z vetsi, ulozime jej do max
|
||
|
return max;
|
||
|
}
|
||
|
|
||
|
int minimum()
|
||
|
{
|
||
|
int selection, max, min = 0;
|
||
|
|
||
|
while ( selection != 8 ) {
|
||
|
int x, y, z;
|
||
|
printf("Zadejte 3 cisla oddelena mezerou: ");
|
||
|
printf("** printmin **\n");
|
||
|
|
||
|
scanf("%d%d%d", &x, &y, &z);
|
||
|
int min = x;
|
||
|
|
||
|
if ( y < min ) {
|
||
|
min = y;
|
||
|
}
|
||
|
if ( z < min ) {
|
||
|
min = z;
|
||
|
}
|
||
|
}
|
||
|
return min;
|
||
|
}
|