ValerianBenchea

Verificare daca n numere sunt in ordine crescatoare

Dec 12th, 2019
261
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.39 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.     int n, a=0, b, i=1, ok=1;
  8.     cout<<"n=";
  9.     cin>>n;
  10.     while(i<=n && ok==1)
  11.     {
  12.         cin>>b;
  13.         if(b<a)
  14.         ok=0;
  15.         i++;
  16.         a=b;
  17.     }
  18.     if(ok==1)
  19.         cout<<"Numerele SUNT in ordine crescatoare";
  20.     else
  21.         cout<<"Numerele NU SUNT in ordine crescatoare";
  22.  
  23.     return 0;
  24. }
Advertisement
Add Comment
Please, Sign In to add comment