C Program to Sum of First and Last Digit of any number

#include<stdio.h>
int main()
{
	int num, first, last, sum;
	printf("Enter Number: ");
	scanf("%d",&num);

	last = num % 10;

	first = num;
	while(first >= 10)
	{
		first = first / 10;
	}

	sum = first + last;

	printf("The Sum of First and Last Digit is: %d", sum);

	return 0;
}

Output

Enter Number: 597857
The Sum of First and Last Digit is: 12