C language question. My task is to get second to the last, third to the last digit etc. from a long. Got a hint to do it by using modulo operator:
int main(void)
{
a = get_long("n:\n");
mod = a % 10;
printf("%i", mod);
}
Works great for the rightmost digit but I just can't figure it out how to get second-, third-to the last digit, and so on. I am trying to put the function into a for loop but it does not work at all. Do you have any ideas how to accopmlish that?
I am not looking for a ready solution - just for the path to follow.