Advertisement
Guest User

Untitled

a guest
Dec 22nd, 2014
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.38 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3. int main()
  4. {
  5. int n,x,y,c,l;
  6. cout<<"Podaj liczbe calkowita"<<endl;
  7. cin>>x;
  8. n=x;
  9. y=-1;
  10. if (x<0) x=-x;
  11. do
  12. {
  13. c=x%10;
  14. x=x/10;
  15. if (c>y)
  16. {
  17. y=c;
  18. l=1;
  19. }
  20. else if (c==y)
  21. l++;
  22. }
  23. while (x!=0);
  24. cout<<"Podana liczba "<<n<<" ma najwieksza cyfre "<<y<<" ktora wystepuje "<<l<<" razy"<<endl;
  25.  
  26. system ("pause");
  27. return 0;
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement