Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main(){
- int i, n, tg;
- int a[i];
- printf("Nhap n vao day: ");
- scanf("%d", &n);
- for ( i = 0; i < n + 1; i++){
- printf("Nhap a[%d] vao day: ", i +1);
- scanf("%d", &a[i]);
- }
- for ( i = 0; i < n; i++){
- if ( a[i] < a[i+1] ){
- tg = a[i];
- a[i] = a[i+1];
- a[i+1] = tg;
- }
- }
- printf ("\nChuoi sau khi sap xep la: ");
- for ( i = 0; i < n; i++) printf(" %d ", a[i]);
- }
Advertisement
Add Comment
Please, Sign In to add comment