#include <stdio.h>
int main() {
int num;
int first_digit;
int last_digit;
int sum;
printf("Enter a number: ");
scanf("%d", &num);
// find the first digit of the number
first_digit = num;
while (first_digit >= 10) {
first_digit /= 10;
}
// find the last digit of the number
last_digit = num % 10;
// calculate the sum of the first and last digits
sum = first_digit + last_digit;
printf("Sum of first and last digit: %d\n", sum);
return 0;
}
I2luY2x1ZGUgPHN0ZGlvLmg+CgppbnQgbWFpbigpIHsKICAgIGludCBudW07CiAgICBpbnQgZmlyc3RfZGlnaXQ7CiAgICBpbnQgbGFzdF9kaWdpdDsKICAgIGludCBzdW07CgogICAgcHJpbnRmKCJFbnRlciBhIG51bWJlcjogIik7CiAgICBzY2FuZigiJWQiLCAmbnVtKTsKCiAgICAvLyBmaW5kIHRoZSBmaXJzdCBkaWdpdCBvZiB0aGUgbnVtYmVyCiAgICBmaXJzdF9kaWdpdCA9IG51bTsKICAgIHdoaWxlIChmaXJzdF9kaWdpdCA+PSAxMCkgewogICAgICAgIGZpcnN0X2RpZ2l0IC89IDEwOwogICAgfQoKICAgIC8vIGZpbmQgdGhlIGxhc3QgZGlnaXQgb2YgdGhlIG51bWJlcgogICAgbGFzdF9kaWdpdCA9IG51bSAlIDEwOwoKICAgIC8vIGNhbGN1bGF0ZSB0aGUgc3VtIG9mIHRoZSBmaXJzdCBhbmQgbGFzdCBkaWdpdHMKICAgIHN1bSA9IGZpcnN0X2RpZ2l0ICsgbGFzdF9kaWdpdDsKCiAgICBwcmludGYoIlN1bSBvZiBmaXJzdCBhbmQgbGFzdCBkaWdpdDogJWRcbiIsIHN1bSk7CgogICAgcmV0dXJuIDA7Cn0=