Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #define MAX 100000
- using namespace std;
- void nhapsonguyenduong(int &n)
- {
- do
- {
- cout << "nhap so vao de kiem tra = ";
- cin >> n;
- if ((n < 0) || (n > MAX))
- {
- cout << "so khong hop le , kiem tra lai";
- }
- } while ((n < 0) || (n > MAX));
- }
- int ktsodoixung(int &n)
- {
- int doixung = 0;
- int temp = n;
- int phantu;
- while (n > 0)
- {
- phantu = n % 10;
- doixung = doixung * 10 + phantu;
- n = n / 10;
- }
- if (doixung == temp)
- return true;
- else
- return false;
- }
- void main()
- {
- int n;
- nhapsonguyenduong(n);
- if (ktsodoixung(n) == true)
- cout << " day la so doi xung" << endl;
- else
- cout <<" day khong phai la doi xung " << endl;
- system("pause");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement