Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- void cifra(int n, int &x)
- {
- int v[10], poz=0;
- x=0;
- while(n)
- {
- v[poz]=n%10;
- poz++;
- n=n/10;
- }
- for(int i=0; i<poz; i++)
- if(v[i]>x)
- x=v[i];
- }
- int main()
- {
- int n=954345, x=0;
- cifra(n,x);
- cout<<x;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement