Odpowiedź:
#include<iostream>
using namespace std;
int main()
{
float a,x1,x2,x3;
string lo;
cout << "Podaj liczbe 3 cyfrowa: ";
cin >> a;
if(a<100 or a>999)
{
cout << "Podana liczba nie jest 3 cyfrowa";
return 0;
}
x1 = int(a)/100;
x1 = int(x1);
x2 = (int(a)/10) - (x1 * 10);
x2 = int(x2);
x3 = int(a) - (x1 * 100 + x2 * 10);
x3 = int(x3);
cout << x3;
cout << x2;
cout << x1 << endl;
if(x1 == x3 and x3 == x1)
{
cout << "Tak";
}
else if (x1 - 1 == x3 or x1 + 1 == x3)
{
cout << "Prawie";
}
else
{
cout << "Nie";
}
}