Question
Diagram below shown a pseudo code to calculate and print the new price after a discount of 10% is given if quantity buying (quantity) greater
Diagram below shown a pseudo code to calculate and print the new price after a discount of 10% is given if quantity buying (quantity) greater than 5 or total amount (totalAmount) greater than 100.
Start
Get unitPrice and quantity
totalAmount = unitPrice * quantity
if(quantity > 5) or (totalAmount > 100) then
discount = 0.1
else
discount = 0
endif
discountAmount = discount * totalAmount
totalAmount = totalAmount discountAmount
display totalAmount
Stop
Write a C code segmnet to calculate the discount using the function named as computeDiscount(). The function will return the total amount after discount
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started