Răspuns:
#include <iostream>
using namespace std;
int ultimaCifra(int x, int y){
return (x + y) % 10;
}
int main()
{
int x, y;
cout << "x = "; cin >> x;
cout << "y = "; cin >> y;
cout << "Ultima cifra a sumei este: " << ultimaCifra(x, y);
return 0;
}