programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
• Campbell Ritchie
• Liutauras Vilda
• Tim Cooke
• Jeanne Boyarsky
• Paul Clapham
Sheriffs:
• Devaka Cooray
• Ron McLeod
• paul wheaton
Saloon Keepers:
• Tim Moores
• Piet Souris
• Tim Holloway
• Stephan van Hulst
• Carey Brown
Bartenders:
• Al Hobbs
• Frits Walraven
• Scott Selikoff

# Splitig integers

Ranch Hand
Posts: 56
• Number of slices to send:
Optional 'thank-you' note:
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

Ranch Hand
Posts: 2412
• Number of slices to send:
Optional 'thank-you' note:
Use / and %

Iain Palmer
Ranch Hand
Posts: 56
• Number of slices to send:
Optional 'thank-you' note:
so say i input 37 i divide by 30 which leaves me 7

Ranch Hand
Posts: 221
• Number of slices to send:
Optional 'thank-you' note:
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
Posts: 56
• Number of slices to send:
Optional 'thank-you' note:
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
Posts: 56
• Number of slices to send:
Optional 'thank-you' note:
I've got it working from numbers 1-10 & 20-99 but am now having trouble witt numbers 11-19

 I can't beleive you just said that. Now I need to calm down with this tiny ad: the value of filler advertising in 2021 https://coderanch.com/t/730886/filler-advertising