Convert Cents to Dollars in C# – C# Programming Example
C# Console

Convert Cents to Dollars in C#

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”.

Source Code:

Output:

Leave a Comment

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

%d bloggers like this: