Contoh Algoritma Sederhana BejanaApp

Fadli Hidayatullah
Aug 28, 2017 · 2 min read

Intro

Berikut merupakan implementasi sederhana dari algoritma beserta dengan pseudocode dan juga program sederhana yang ditulis dengan bahasa pemrograman Pascal. Untuk penjelasan apa itu algoritma, kamu bisa membaca artikel sebelumnya, yakni Pengenalan Algoritma.

Algoritma

1. Let bejanaA, bejanaB, and temp As String
2. Ask user to input something for bejanaA
3. Set bejanaA value
4. Ask user to input something for bejanaB
5. Set bejanaB value
6. Set temp get from bejanaA
7. Set bejanaA get from bejanaB
8. Set bejanaB get from temp
9. Unset temp
10. Display the result

Pseudocode

{ Header }
BejanaApp_Algoritm
{ BejanaApp is a simple program that move bejanaA value to bejanaB that inputted by user }
{ Dictionary }
bejanaA : String
bejanaB : String
temp : String
{ Algorithm / Operation }
{ Get user input }
Output('Please type something for bejanA : ')
Input(bejanaA)
Output('Please type something for bejanaB : ')
Input(bejanaB)
{ Move bejana }
temp <- bejanaA
bejanaA <- bejanaB
bejanaB <- temp
temp <- ''
{ Display output }
Output('BejanaA : ' + bejanaA)
Output('BejanaB : ' + bejanaB)
Output('Nice :D')

BejanaApp

{ BejanaApp is a simple program that move bejanaA value to bejanaB that inputted by user }
program BejanaApp;
uses crt;
{ Declare variables }
var
bejanaA, bejanaB, temp : string;
{ Main program block where the program starts }
begin
clrscr; { Clear the screen }
{ Get user input }
write('Please type something for bejanaA : ');
readln(bejanaA);
write('Please type something for bejanaB : ');
readln(bejanaB);
{ Move bejana }
temp := bejanaA;
bejanaA := bejanaB;
bejanaB := temp;
temp := '';
{ Display output }
writeln();
writeln('BejanaA : ', bejanaA);
writeln('BejanaB : ', bejanaB);
writeln('Nice :D');
readkey();
end.

The Last but not Least

Hopefully this can be useful for me and for everyone who read this article. We need to be a youth that have purpose in this life, want to change the society and make it better. We need young muslims to be people of visions. Find your passions and Start contributes to the projects of Islam.

)
Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade