Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- #include<conio.h>
- void main()
- {
- clrscr();int a[30];
- int n,i,t;
- printf("nhap n:");
- scanf("%d",&n);
- for(i=0;i<n;i++)
- {
- printf("\n phan tu a[%d]:",i);
- scanf("%d",&a[i]);
- }
- printf("\n mang nhap vao la:");
- for(i=0;i<n;i++)
- printf("%d ,",a[i]); printf("\n mang tang dan:");
- for(i=0;i<n;i++)
- {
- if(a[i]>a[i+1])
- {
- t=a[i];
- a[i]=a[i+1];
- a[i+1]=t;
- }
- printf("%d",a[i]);
- }
- getch();
- }
Add Comment
Please, Sign In to add comment