Converting Cents to Dollars in Python – C# Programming Example
Python 3

Converting Cents to Dollars in Python

Write a statement that prints the value of price in the form “X dollars and Y cents” on a line by itself.

So, if the value of price was 2345, your code would print “23 dollars and 45 cents”.

If the value was 501 it would print “5 dollars and 1 cents”. If the value was 99 your code would print “0 dollars and 99 cents”.

Solution 1:

 

Solution 2: 

 

Output:

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: