Jumat, 19 April 2013

Pengurutan Bilangan mengunakan Turbo Pascal

Berikut ini adalah program sederhana Pengurutan dari tiga bilangan yang dimasukkan secara acak..

Output Program :

 
 
Source codenya :

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.

Artikel Terkait:

Share this article now on :

Posting Komentar

:)) ;)) ;;) :D ;) :p :(( :) :( :X =(( :-o :-/ :-* :| 8-} :)] ~x( :-t b-( :-L x( :-p =))