#include <iostream> int main () { int number; int lastNumber; std :: cout << "Введите число: "; std :: cin >> number; while (number != 0) { lastNumber = number % 10; if (lastNumber != 1 && lastNumber != 0) break; number /= 10; } if (lastNumber == 1 || lastNumber == 0) { std :: cout << "Робот все понял!\n"; } else { std :: cout << "Машинный код состоит не только из 0 и 1. Ошибка!\n"; } }
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter