Find last digit of number - C Program

C program to read a number and print last digit of the number.

Solution:

In this program, accept an input from user as any integer number and find the last digit of that number using mod(%) operator. This operator gives value in the reminder .

#include <stdio.h>
void main()
{
      int n,l;
      printf("Enter Any Integer Number \n");
      scanf("%d", &n);
      l=n%10;
      printf("Last digit of %d \n is %d",n,l);
}


Output:

last digit of number