Computer Science, asked by manjotchhina88, 7 months ago

Write a program that converts the number of cents into dollars and cents. The user will be asked to enter the number of cents (example: 216 cents are equivalent to 2 dollar(s) and 16 cents)

Answers

Answered by Anonymous
98

\large\boxed{\underline{\mathcal{\blue{QUeSTIoN}}}}

□Write a program that converts the number of cents into dollars and cents. The user will be asked to enter the number of cents.

\bf\large\red{AnSWeR}

●The programme will need variables to represent the number of each type of coin.

Since, the number of coins has to be an integer, these variables are of type int. I'll call the variables quarters, dimes, nickels, and pennies.

The total value of the coins, when expressed in dollars, can be a non-integer number such as 1.57 or 3.02.

●Since, the total value in dollars is a real number, I will use a variable of type double to represent it

The variable is named dollars.

Similar questions