Advertisement
rotti321

Test 5 BAC2021 SIII ex 1

Sep 20th, 2021
1,053
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.30 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main() {
  6.     int n,a,b;
  7.     bool ok=true;
  8.     cin >> n;
  9.     a=n%10;
  10.     while(n!=0){
  11.       b=n%10;
  12.       n=n/10;
  13.       if(b!=a){
  14.            ok=false;
  15.            break;
  16.       }
  17.     }
  18.     if(ok==true) cout<<1;
  19.      else cout<<0;
  20.     return 0;
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement