Contoh Program Pascal mengurutkan bilangan
uses wincrt;
var A,B,C:integer;
Begin
Writeln('Program Menurut Bilangan');
Writeln('=========================');readln;
readln;
write('Masukan Nilai A: ');readln(A);
write('Masukan Nilai B: ');readln(B);
write('Masukan Nilai C: ');readln(C);
readln;
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.
Kurang Relevan? Coba Pencarian Lain!
uses wincrt;
var A,B,C:integer;
Begin
Writeln('Program Menurut Bilangan');
Writeln('=========================');readln;
readln;
write('Masukan Nilai A: ');readln(A);
write('Masukan Nilai B: ');readln(B);
write('Masukan Nilai C: ');readln(C);
readln;
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.
1 komentar:
sangat membantu
Posting Komentar