hello all
my problem is a confusion on the second problem here i managed to solve the first problem and made the program i hope its correct as u see..

First problem
Three memory locations A, B, and C contain numbers. Write down the algorithm for finding and printing the largest number

Input of the algorithm: Memory locations A, B, and C.
Output of the algorithm: print the contents of the memory location that contains the largest number.

The Pseudo code is

Begin

If A>B
If A>C print “A is the Biggest”
Otherwise print “C is the Biggest”
Otherwise
If B>C print “B is the Biggest”
Otherwise print “C is the Biggest”

End

i need the pseudo code so i can make the program but i am really confused about this question:

Second question
Three memory locations A, B, and C contain numbers. Write down the algorithm that sorts these numbers in an descending order.

Input of the algorithm: Memory locations A, B, and C.
Output of the algorithm: print the contents of the three memory location in an descending order.

i want to make the program but i miss the logic so i need pseudo code to understand it and make it.. help me please i nearly lost it at the second question xD

Thanks
Jeff

2
Contributors
4
Replies
5
Views
6 Years
Discussion Span
Last Post by doom2100

1. You need to create 3 int, high, mid, low (or any name you want).

2. Then compare A and B

If A > B
high = A
low = B
Else
high = B
low = A
EndIf

3. Then compare C with hig and low.

If C > high
mid = high
high = C
Else
If C > low
mid = C
Else
mid = low
low = C
EndIf
EndIf

6. Print high, mid, low

Thanks solved