![]() |
|
#1
|
|||
|
|||
Breaking the number into two digitsHello!
I would like to know how to break the number into two digits. For example, if I enter number 45 it should print "You entered number forty five." I would like to do it with switch statement. If anybody could help I would appreciate that. Thanks. |
|
#2
|
||||
|
||||
|
Hello Amir.
Here are a couple threads that you should take a look at, especially the last one. Integer splitting C help I think these should give you a pretty good start on what you want to do. Good luck! |
|
#3
|
||||
|
||||
|
Quote:
x = 536 % 10; // x gets the remainder of 6 y = 536 / 10; // y gets the value 53 |
|
#4
|
||||
|
||||
|
Quote:
Just make sure you're using int math |
Recent GIDBlog
Meeting the local Iraqis by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| c: array comparison | jack | C Programming Language | 7 | 26-Jan-2004 11:21 |
| Random() : Make each number onlu appear once | NiXeN | C++ Forum | 3 | 13-Jan-2004 04:47 |
| How to find the last 6 digits of a 8 digit number? | rjd72285 | C++ Forum | 3 | 28-Oct-2003 08:21 |
| Displaying the Post Number | BobbyDouglas | Open Discussion Forum | 4 | 10-Oct-2003 10:43 |
| auto number | skyloon | MySQL / PHP Forum | 1 | 30-Jun-2003 08:33 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The