Question: C programming write code for: Integers numSodas and allowance are read from input. A soda costs 5 dollars. If numSodas is less than 3 ,

C programming write code for:
Integers numSodas and allowance are read from input. A soda costs 5 dollars.
If numSodas is less than 3, then output "Please purchase at least 3."
If numSodas is greater than or equal to 3, then assign variable totalCost with the product of numSodas and 5.
If totalCost is less than or equal to allowance, then output "Successful purchase!"
Otherwise, output "Need more money to purchase all."
If numSodas is greater than 28, then output "Restocking soon."

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!