Advertisement
marius7122

Untitled

Jul 9th, 2019
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.29 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int n;
  6.  
  7. int main()
  8. {
  9.     cout<<"n = "; cin>>n;
  10.  
  11.     int cifMax = 0;
  12.     while(n > 0)
  13.     {
  14.         if(n % 10 > cifMax)
  15.             cifMax = n % 10;
  16.         n = n / 10;
  17.     }
  18.  
  19.     cout<<"cifra maxima este "<<cifMax;
  20.  
  21.     return 0;
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement