0% found this document useful (0 votes)
8 views3 pages

Pseudocode 4

Uploaded by

divaxo5320
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views3 pages

Pseudocode 4

Uploaded by

divaxo5320
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 3

DECLARE price, total: Real

DECLARE counter: Integer

counter = 0

REPEAT
PRINT "Enter the price of the house"
input price

IF price > 200000 then


total = price + 0.02 * price
ELSE
IF price > 100000 then
total = price + 0.015 * price
ELSE
IF price > 50000
total = price + 0.01 * price
ELSE
total = price
ENDIF
ENDIF
ENDIF
OUTPUT "Total price is: ", total

UNTIL counter > 5000

---------------

DECLARE price, total: Real


DECLARE counter: Integer

FOR counter 1 TO 5000


PRINT "Enter the price of the house"
input price

IF price > 200000 then


total = price + 0.02 * price
ELSE
IF price > 100000 then
total = price + 0.015 * price
ELSE
IF price > 50000
total = price + 0.01 * price
ELSE
total = price
ENDIF
ENDIF
ENDIF
OUTPUT "Total price is: ", total

NEXT counter
ENDFOR

------------

DECLARE price, total: Real


DECLARE counter: Integer

WHILE counter < 5000


PRINT "Enter the price of the house"
input price

IF price > 200000 then


total = price + 0.02 * price
ELSE
IF price > 100000 then
total = price + 0.015 * price
ELSE
IF price > 50000
total = price + 0.01 * price
ELSE
total = price
ENDIF
ENDIF
ENDIF
OUTPUT "Total price is: ", total

counter = counter + 1

ENDWHILE

-----------------0--------------------

DECLARE counter, no_tickets, price: Integer

PRINT "Enter the amount of tickets to buy"


input no_tickets

IF no_tickets > 25 THEN


OUTPUT "You cannot buy this many tickets at once"
ELSE
IF no_tickets > 20 THEN
price = 0.8 * (no_tickets * 20 )
ELSE
IF no tickets > 10 THEN
price = 0.9 * (no_tickets * 20)
ELSE
price = no_tickets * 20
ENDIF
ENDIF
ENDIF

OUTPUT "Your total will be: ", price

------------0----------------

DECLARE temp: Real


DECLARE temp_above, temp_below, day_count: Integer

temp_above = 0
temp_below= 0

FOR day_count 1 TO 100


PRINT "What is the temperature today?"
input temp

IF temp >= 20 THEN


temp_above = temp_above + 1
ELSE
temp_below = temp_below + 1
END IF
ENDFOR

OUTPUT "Number of days with the temperature below 20C: ", temp _below

OUTPUT "Number of days with the temperature above or equal to 20C: ", temp_above

You might also like