Advertisement
Dizzy3113

Untitled

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