Format the given number into an American currency format

Convert a given number into the formatted number.

Logic

  • Traverse the string in the reverse order

  • Consider the following cases :

  • Positive numbers,

  • Negative numbers,

  • Positive floating point numbers,

  • Negative floating point numbers

 

Solution


You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *

Show Buttons
Hide Buttons