-2

How can I split an int number with out using string, for example for the number 123456 and 2 splits i should print = 12|34|56

for 1234567 and 3 splits I should print = 1|234|567 from right to left Sincerely.

Muhammed
  • 1
  • 2

1 Answers1

1

You can use the mod operator with powers of 10 to get remainders

similar question answered here: How to get the separate digits of an int number?

Jaknoob
  • 11
  • 1