Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- int a[10]={2,5,7,3,6,7,1,0,1,4};
- int m=a[0];
- for (int i=1;i<10;i++){
- if (a[i]>m){
- m=a[i];
- }
- }
- int b[m+1];
- for (int i=0;i<m+1;i++){
- b[i]=0;
- }
- for (int i=0;i<10;i++){
- int ind=a[i];
- b[ind]+=1;
- }
- int c[10],q;
- for(int j=0;j<m+1;j++){
- for(int k=0,q=0;k<b[j] && q<10;k++,q++){
- c[q]=j;
- cout<<c[q];
- }
- }
- }
Add Comment
Please, Sign In to add comment