PDA

View Full Version : Write basic Pseudo code If-t


Khmergurl1001
Nov 7, 2009, 07:23 AM
WRITE the basic pseudo code IF-THEN-ELSE statement for each of the following:

 

1. If sum is greater than 100, print sum.
2. If sum is greater than 5, print sum else add 10 to sum.
3. If grade is greater than or equal to 90, print “A” else if grade is greater than or equal 80, print “B”, else print “F”.

KISS
Nov 7, 2009, 08:11 AM
This problem is really odd, because I consider those statements pseudocode. The only thing I can think of is that someone wants s you to substitute logical expressions for the conditionals:

e.g.


2. If sum is greater than 5, print sum else add 10 to sum.

If sum > 5 then print sum else sum = sum +10

Perito
Nov 7, 2009, 11:00 AM
KISS is quite correct. The pseudo-code is already there. You might format it into something like this:

1. If sum > 100 then
... Print sum
2. If sum > 5 then
... Print sum
... Else
... Add 10 to Sum
3. If Grade > 90 then
... Print "A"
... Else if Grade > 80 then
... etc.

colette35
Oct 30, 2011, 08:29 AM
1. If sum is greater than 100, print sum