aspose file tools*
The moose likes Beginning Java and the fly likes Splitig integers Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Splitig integers" Watch "Splitig integers" New topic
Author

Splitig integers

Iain Palmer
Ranch Hand

Joined: Jul 28, 2004
Posts: 56
I'm writing the program say and am wondering how to split an integer into 2 separate numbers, I'm sure it simple but I can't think of how to do it? I had thought about not spliting the integer and just ahving a very big switch statment but thought there must be a better way
Keith Lynn
Ranch Hand

Joined: Feb 07, 2005
Posts: 2367
Use / and %
Iain Palmer
Ranch Hand

Joined: Jul 28, 2004
Posts: 56
so say i input 37 i divide by 30 which leaves me 7
Horatio Westock
Ranch Hand

Joined: Feb 23, 2005
Posts: 221
Hi,

When you say 'split an integer', what exactly to you mean?

Do you have a practical example to help us understand?

Thanks.
Iain Palmer
Ranch Hand

Joined: Jul 28, 2004
Posts: 56
I'm writing the program for the assignment Java-4(Say) in the Cattle Drive and when a number is input into the program say 57. I want to be able to arrange the numbers so I can get the fifty and output that then add the seven onto it separatly
Iain Palmer
Ranch Hand

Joined: Jul 28, 2004
Posts: 56
I've got it working from numbers 1-10 & 20-99 but am now having trouble witt numbers 11-19
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Splitig integers