-3

'How can I obtain the last digit from a number in C? For example I want to obtain the "5" from number "125", or "1" from number "24581". I have tried some division operations but it's not working.

1 Answers1

0

Using sscanf you can convert an int into a string, then you can get all the digits you want

SCdev
  • 101
  • 2
  • 12