Berikut ini adalah program sederhana Pengurutan dari tiga bilangan yang dimasukkan secara acak..
Output Program :
Source codenya :
Output Program :
program swift; uses wincrt; var A, B, C : Integer; begin write('Masukkan Nilai A : '); readln(A); write('Masukkan Nilai B : '); readln(B); write('Masukkan Nilai C : '); readln(C); writeln; if (A <= B) and (A <= C) then if B <= C then writeln(A,' ',B,' ',C) else writeln(A,' ',C,' ',B) else if (B <= A) and (B <= C) then if A <= C then writeln(B,' ',A,' ',C) else writeln(B,' ',C,' ',A) else if (C <= A) and (C <= B) then if A <= B then writeln(C,' ',A,' ',B) else writeln(C,' ',B,' ',A); end.
Posting Komentar