Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- program min_max_cifry;
- uses crt;
- type cifry=0..9999;
- cifra=0..9;
- var c:cifry;
- c1,c2,c3,c4,max,min:cifra;
- begin
- write('Zadajte 4ciferne cislo: ');
- textcolor(lightgreen);
- readln(c);
- normvideo;
- max:=0;
- min:=9;
- c1:= c mod 10;
- c:= c div 10;
- c2:= c mod 10;
- c:= c div 10;
- c3:= c mod 10;
- c:= c div 10;
- c4:= c mod 10;
- if c1<min then min:=c1;
- if c2<min then min:=c2;
- if c3<min then min:=c3;
- if c4<min then min:=c4;
- if c1>max then max:=c1;
- if c2>max then max:=c2;
- if c3>max then max:=c3;
- if c4>max then max:=c4;
- write('Najmensia cifra: ');
- textcolor(yellow);
- writeln(min);
- normvideo;
- write('Najvacsia cifra: ');
- textcolor(yellow);
- writeln(max);
- normvideo;
- readln;
- end.
Advertisement
Add Comment
Please, Sign In to add comment