Advertisement
Guest User

Untitled

a guest
Nov 20th, 2019
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.52 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.     int liczba, x, y = -1;
  8.     bool flaga = true;
  9.     cin >> liczba;
  10.  
  11.     while(liczba > 0)
  12.     {
  13.         x = y;
  14.         y = liczba % 10;
  15.         liczba = liczba / 10;
  16.         if(x >= y)
  17.         {
  18.             flaga = false;
  19.             break;                  // automatyczne wyjście z pętli
  20.         }
  21.     }
  22.     if(flaga)
  23.         cout << "Cyfry sa ulozone malejaco\n";
  24.     else
  25.         cout << "Cyfry nie sa ulozone malejaco\n";
  26.     return 0;
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement