Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Tema nr.17
- #include<iostream.h>
- #include<conio.h>
- int main()
- {
- int v[100],i,k,n,s;
- cout<<"n=";cin>>n;
- for(i=0;i<n;i++)
- {
- cout<<"V["<<i<<"]=";cin>>v[i];
- }
- for(i=0;i<n-1;i++)
- for(k=i+1;k<n;k++)
- {c++;
- if(!v[i]>v[k])
- {
- s=v[i];
- v[i]=v[k];
- v[i]=s;
- }
- }
- for(i=0;i<n;i++)
- cout<<v[i]<<" ";
- getch();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement