#include <stdio.h>
int main()
{
int num, first, last;
/* First number */
printf("Enter any number: ");
scanf("%d", &num);
first = num;
while (first >= 10)
{
first = first / 10;
}
printf("First digit = %d \n", first);
/* last number */
last = num % 10;
printf("First digit = %d", last);
return 0;
}
Output:-
Enter any number : 645645
First digit = 6
First digit = 5
0 Comments