Advertisement
Alx09

varianta cu while

Feb 5th, 2022
944
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. {
  7.     char numar[30];
  8.    cin >> numar;
  9.     if(!numar[1]){
  10.         return 0 ;
  11.     }
  12.     int i = 0;
  13.     while(numar[i+1] && numar[i] < numar[i + 1]){
  14.       ++i;
  15.     }
  16.   numar[i] = '\0';
  17.   cout << numar << numar + i + 1;
  18.  
  19.  
  20.     return 0;
  21. }
  22.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement