You are on page 1of 2

1.

Algorithm Lower Value


This algorithm prompts the user to input two unequal values and determines the lower value.

Var:
num1,num2:real

START
Print “Please enter the first number.”
Read num1
Print “Please enter the second number.”
Read num2
IF num1<num2 THEN
Print "The lower value is", num1
ELSE
Print "The lower value is”, num2
STOP

2. Algorithm Price_Discount
This algorithm calculates and applies a discount based on the price of an item in a shoe store.

Var:
price,disc_price:real

START
Print “Please enter the price of the item”
Read price
IF price <= 2500 THEN
disc_price ← price + (price*0.02)
ELSE
disc_price ← price + (price*0.05)
Print “The discounted price is”, disc_price
STOP

3. Algorithm Double_Num
This algorithm prompts the user to enter a number between 1 and 9, doubles it, and adds 5 or 10
based on a condition.

Var:
num,double_num,sum:real
START
Print “Please enter a number between 1 and 9”
Read num
double_num ← num*2
IF double_num > 20 THEN
sum ← double_num + 5
ELSE
sum ← double_num + 10
Print “The sum is”, sum
STOP

You might also like