Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "stdio.h"
- #include "stdlib.h"
- void main()
- {
- int *a,k=0,buff;
- a=(int*)malloc(100*sizeof(int));
- do
- {
- scanf("%d",(a+k));
- k++;
- }
- while(*(a+k-1)!=42);
- --k;
- for(int i=0;i<k;i++)
- for(int j=i+1;j<k;j++)
- {
- if(a[i]>a[j]) {buff=a[i]; a[i]=a[j]; a[j]=buff;}
- }
- for(int i=0;i<k;i++) printf("%d\n",a[i]);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement