A simple method is to use the modulo (%) operator and integer division. Here's how you can extract each digit from a number like 125:
Get the last digit using modulo 10:125 % 10 = 5
Remove the last digit by dividing by 10:125 / 10 = 12 (integer division)
Get the next digit:12 % 10 = 2
Remove the last digit again:12 / 10 = 1
Now you’ve extracted all three digits: 1, 2, and 5.You can store them in variables, an array, or use them however you need.