👤

Se dau doua numere naturale x si y . Calculati ultima cifra a sumei lor !
Help pleasee !


Răspuns :

Program info;
var x,y,suma:integer;
begin
write('x='); readln(x);
write('y='); readln(y);
suma:=x+y;
write('Ultima cifra este:',suma mod 10);
readln;
end.


#include <iostream>
using namespace std;
int main()
{
     int x,y;
     cin>>x>>y;
     cout<<(x+y)%10;
}