Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- int n,x,y,c,l;
- cout<<"Podaj liczbe calkowita"<<endl;
- cin>>x;
- n=x;
- y=-1;
- if (x<0) x=-x;
- do
- {
- c=x%10;
- x=x/10;
- if (c>y)
- {
- y=c;
- l=1;
- }
- else if (c==y)
- l++;
- }
- while (x!=0);
- cout<<"Podana liczba "<<n<<" ma najwieksza cyfre "<<y<<" ktora wystepuje "<<l<<" razy"<<endl;
- system ("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement