![]() |
|
#1
|
|||
|
|||
Write a program that inputs one 3-digit number....Write a program that inputs one 3-digit number (example: 854), seperates the number into its individual digits (hundreds, tens and ones) and prints each digit as below. (Hint: use combinations of integer division and the remainder operation).
İm tryn but i dont know my fault may you help me CPP / C++ / C Code:
Last edited by LuciWiz : 09-Dec-2008 at 15:07.
Reason: Please insert your C code between [cpp] & [/cpp] tags
|
|||
|
#2
|
||||
|
||||
Re: Write a program that inputs one 3-digit number....That's because int num=x*100+y*10+z; doesn't do anything.
You have to split the number after you read it. Look into the % operator, as in: val = num % 5 __________________
The 3 Laws of the Procrastination Society: 1) Never do today that which can be put off until tomorrow 2) Tomorrow never comes |
|
#3
|
|||
|
|||
Re: Write a program that inputs one 3-digit number....Dear Friend
If you want to display the number into its individual digits (hundreds, tens and ones), you can use the following coding also. But it is working for only three digits. CPP / C++ / C Code:
Last edited by LuciWiz : 19-Feb-2010 at 07:16.
Reason: Please insert your C code between [cpp] & [/cpp] tags
|
Recent GIDBlog
Problems with the Navy (Officers) by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Equation solver | RazoR | C Programming Language | 3 | 18-May-2008 09:24 |
| malloc/free usage, and general good programming behavior | lavaka | C Programming Language | 7 | 14-Jun-2007 19:50 |
| floating point decimal to ascii conversion | crazypal | C Programming Language | 5 | 18-Apr-2007 04:59 |
| Dice rolling program (random number generator) | crystalattice | Python Forum | 1 | 17-Apr-2006 17:34 |
| Apache2 config issues | monev | Apache Web Server Forum | 2 | 28-Jun-2004 06:19 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The