Last Digit:
#include<stdio.h> int main(){ int num,lastdigit; printf("enter any number:"); scanf("%d",&num); lastdigit=num%10; printf("lastdigit = %d",lastdigit); return 0; }
First Digit:
#include<stdio.h> int main() { int num,first; scanf("%d",&num); first=num; while(first>=10) { first=first/10; } printf("%d",first); return 0; }