Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main(){
- int n, v[1000], temp;
- cout << "n= "; cin >> n;
- for(int i = 0; i < n; i++){
- cout << "v[" << i << "]= ";
- cin >> v[i];
- }
- for(int i = 0; i < n; i++){
- for(int j = i; j < n; j++){
- if(v[j] > v[i]){
- temp = v[j];
- v[j] = v[i];
- v[i] = temp;
- }
- }
- }
- for(int i = 0; i < n; i++){
- cout << v[i] << ' ';
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment