Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include<stdlib.h>
- int main() {
- int n[] = {9,7,3,1};
- int i, aux, mud;
- mud = 1;
- while(mud == 1) {
- mud= 0;
- i=0;
- while(i<=sizeof(n)/sizeof(int)-2) {
- if(n[i] > n[i+1]) {
- aux = n[i];
- n[i] = n[i+1];
- n[i+1] = aux;
- mud= 1;
- }
- i++;
- }
- }
- for(i=0; i<=3; i++) {
- printf("%d\n", n[i]);
- }
- system ("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment