Method:
Step 1. Get the last digit of the given number by using the Modulus operator(%).
Step 2. Print it.
Step 3. Get the remaining digits of the number.
Step 4. Repeat Step 1 to 3 until the given number becomes 0.
The logical part of C Program:
While(num != 0)
{
lastdigit = num % 10;
printf("%d",lastdigit);
num = num/10;
}
Result:
You try with any number and let me know the feedback. Useful for exams and interviews.