Thread: Help Me PLease

  1. #1
    Registered User
    Join Date
    Jan 2010

    Help Me PLease

    This is my last exercise and i seriously can't get it done please help....
    Write a program that inputs a five-digit integer, separates the integer into its individual digits and prints the digits separated from one another by three spaces each. [Hint: Use the integer division and modulus operators.] For example, if the user types in 42339, the program should print:

    4 2 3 3 9

  2. #2
    Registered User
    Join Date
    Oct 2006
    First, you wont get much help if you dont make an attempt (or show your attempt if you have done so).

    [Hint: Use the integer division and modulus operators.]
    This is the solution, let alone a "hint". Try the number, say, '12345'. What is this number modulo 10? (i.e. 12345 % 10)? That takes care of the "modulus" hint. You now need to think about what you do with the "division" hint.

Popular pages Recent additions subscribe to a feed