How to elimintae alternate numbers in a given number by using static method with parameters. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How to elimintae alternate numbers in a given number by using static method with parameters.

For example, if the given number is 12345 then print output as 135.

10th May 2018, 11:00 AM
sriram rathod
sriram rathod - avatar
2 Answers
+ 5
Here's a hint for you:- You can treat it as a string and pick only the digits on even-number index only. 😉
10th May 2018, 11:33 AM
Zephyr Koo
Zephyr Koo - avatar
0
Without using strings or arrays.
11th May 2018, 10:42 AM
sriram rathod
sriram rathod - avatar