First and Last Digit codechef solution in c++
#include <iostream>
using namespace std;
int main() {
int T;
cin >> T;
while (T--) {
int N;
cin >> N;
int first = N % 10;
while (N >= 10) {
N /= 10;
}
int last = N;
cout << first + last << endl;
}
return 0;
}