Write a C++ program to check if two given non-negative integers have the same last digit
- برمجة سي بلس بلس
- برمجة
- 2021-05-11
- MarwaMohammed
الأجوبة
#include <iostream>
using namespace std;
bool test(int x, int y)
{
return abs(x % 10) == abs(y % 10);
}
int main()
{
cout << test(123, 456) << endl;
cout << test(12, 512) << endl;
cout << test(7, 87) << endl;
cout << test(12, 45) << endl;
return 0;
}أسئلة مشابهة
القوائم الدراسية التي ينتمي لها السؤال
