Advertisement
Guest User

Untitled

a guest
Mar 23rd, 2017
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. #include <iostream>
  2. #include <limits.h>
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7. int n,k=0,m,cif,a[100],b[100];
  8. cout<<"n=";
  9. cin>>n;
  10. for (int i=1; i<=n; i++)
  11. {
  12. m=INT_MIN;
  13. cout<<"a=";
  14. cin>>a[i];
  15. while (a[i])
  16. {
  17. cif=a[i]%10;
  18. a[i]/=10;
  19.  
  20. if (m<cif)
  21. m=cif;
  22. }
  23. b[k++]=m;
  24. }
  25. for (int i=0; i<k; i++)
  26. cout<<b[i]<<" ";
  27.  
  28. return 0;
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement