3. Write an algorithm and pseudocode which asks a user to enter the price of an item. Once the user enters the price, calculate the discount at 10% and print the discount amount and the new price after the 10% discount
read price
discount = 0.10 * price
sale = price - discount
print discount, sale
Algorithm:
1. Start
2. Ask the user to enter the price of an item
3. Read the input price from the user
4. Calculate the discount amount by multiplying the price by 0.1 (10%)
5. Calculate the new price by subtracting the discount amount from the original price
6. Print the discount amount
7. Print the new price
8. Stop
Pseudocode:
```
Start
Display "Enter the price of an item: "
Read price from user
discount = price * 0.1
new_price = price - discount
Display "Discount amount: " + discount
Display "New price after discount: " + new_price
Stop
```
Algorithm:
1. Start
2. Take input from the user for the price of the item
3. Calculate the discount amount by multiplying the price by 10% (0.10)
4. Calculate the new price after the discount by subtracting the discount amount from the original price
5. Print the discount amount and the new price
6. End
Pseudocode:
1. Start
2. Display "Enter the price of the item:"
3. Read price
4. discountAmount = price * 0.10
5. newPrice = price - discountAmount
6. Display "Discount amount: " + discountAmount
7. Display "New price after discount: " + newPrice
8. End