Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- {This program sorting 3 numbers in ascending order}
- program sort;
- uses crt;
- var
- a, b, c, x: real;
- begin
- clrscr;
- write('Enter a,b,c: ');
- readln(a, b, c);
- if a > b
- then
- if b > c then { A max, C min }
- begin
- x := a;
- a := c;
- c := x;
- end
- else
- if c < a then { A max, B min }
- begin
- x := a;
- a := b;
- b := c;
- c := x;
- end
- else { C max, B min }
- begin
- x := b;
- b := a;
- a := x;
- end
- else
- if c < a then { B max, C min }
- begin
- x := b;
- b := a;
- a := c;
- c := x;
- end
- else
- if c < b then { B max, A min }
- begin
- x := b;
- b := c;
- c := x;
- end;
- writeln(a:1:2, ',', b:1:2, ',', c:1:2);
- end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement