Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- using namespace std;
- int main(){
- int liczba, a = 0,sprawdzenie=0;
- int tabLiczba[10];
- cin >> liczba;
- int kopiaLiczba = liczba;
- while (liczba){
- liczba /= 10;
- a++;
- }
- liczba = kopiaLiczba;
- for (int i = 0; i < 10; i++){
- tabLiczba[i] = liczba % 10;
- liczba /= 10;
- }
- for (int i = 0; i <= a; i++){
- if (tabLiczba[i] == tabLiczba[a-1-i])
- sprawdzenie++;
- }
- if (sprawdzenie == a){
- cout << "Liczba lustrzana" << endl;
- }
- else
- cout << "Liczba nie jest lustrzana" << endl;
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement