Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- main()
- {
- int n,pom,k;
- cin>>n;
- int T[n];
- for(int i=0;i<n;i++)
- {
- cin>>T[i];
- }
- for(int i=1;i<n;i++)
- {
- pom=T[i];
- k=i-1;
- while(k>=0 && T[k]>pom)
- {
- T[k+1]=T[k];
- k=k-1;
- }
- T[k+1]=pom;
- }
- for(int i=0;i<n;i++)
- {
- cout<<T[i];
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement