I need to write function chiffre(int nombre,int place) | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

I need to write function chiffre(int nombre,int place)

Hello World! /////////// write the function chiffre(int nombre ,int place) That returns the digit that is in the specified place /////////// How I can delete numbers on the left, for exemple in 123 To become 3 As we know, the numbers on the right can be deleted by dividing by 10. /////////// Thanks.

12th May 2019, 1:52 PM
mohamed Jfr
mohamed Jfr - avatar
3 Answers
+ 4
you can use the modulus to do that, 123%10=> 3
12th May 2019, 2:09 PM
✳AsterisK✳
✳AsterisK✳ - avatar
+ 2
num = num%10;
12th May 2019, 2:08 PM
kiRA
kiRA - avatar
+ 1
Thanks bro
12th May 2019, 2:20 PM
mohamed Jfr
mohamed Jfr - avatar