a three digit number in input through the keyboard.write a c program to display the last digit number
Answers
Answered by
0
Answer:
#include<stdio.h>
void main()
{
int number = 538; // input
int last_digit = number % 10; // Last Digit Logic
printf("%d",last_digit);
}
Explanation:
The last digit of any number can be find out by taking the modulus of that number with 10.
Modulus (%) operator output the remainder.
eg - 4 % 2 = 0
Similar questions