Question: Write a C program that converts knuts to sickles and galleons (the currency of the HarryPotter novels).The user will enter the total number of knuts.

Write a C program that converts knuts to sickles and galleons (the currency of the HarryPotter novels).The user will enter the total number of knuts. There are 29 knuts in one sickle and 17 sickles in one galleon.

Hint: Divide the amount by the number of knuts in one galleon to determine the number of galleons, and then reduce the amount by the total value of the galleons (You can also use a remainder operator). Repeat for sickles. Be sure to use integer values throughout, no floating-point numbers.

If the amount entered is less than zero or greater than one billion (1000000000), output an error message and abort the program.

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!