#include <stdio.h>
main()
{
int num, last ;
printf("Enter any number : ");
scanf("%d", &num);
last = num%10;
printf("The last digit of entered number: %d\n", last);
while(num>=10)
{
num = num/10;
}
printf("The first digit of entered number: %d\n", num);
}
Result:
Enter any number : 123456
The last digit of entered number: 6
The first digit of entered number: 1
need an explanation for this answer? contact us directly to get an explanation for this answer