As a way of covering everything you have learned thus far, including console input and output, Code Sample 5.3 contains a simple program that calculates the percentage based on a maximum and partial value. So if you were to enter 100 and 10, the result would be 10%.
Before reading the code, you might like to think about which features of the C language are used to create the program. You need a way to:
Read in values
Store the values
Perform the calculation
Display the result
You might not like to restrict the users to small values, so you should use the largest integers possible to store data. The percentage is likely to be between 0 and 100, but it could also be a floating-point value, so that ...