Advertisement
Dizzy3113

Untitled

Nov 17th, 2019
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.24 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4. void cifra(int n, int &x)
  5. {
  6. x=0;
  7. while(n)
  8. {
  9. if(n%10>x)
  10. x=n%10;
  11. n=n/10;
  12. }
  13.  
  14. }
  15. int main()
  16. {
  17. int n=954345, x=0;
  18. cifra(n,x);
  19. cout<<x;
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement