Reginaldojs

exercicio 9,lista 4

May 16th, 2012
42
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.47 KB | None | 0 0
  1. #include<stdio.h>
  2. int main(){
  3.          int []={8,9,5,1};
  4.          int aux,trocou,i;
  5.          trocou=1;
  6.          while(trocou==1){
  7.              trocou=0;
  8.              for(i=0;i<=2;i++)
  9.                 if(n[i]>n[i++]){
  10.                   aux=n[i];
  11.                   n[i]=n[i+1];
  12.                   n[i+1]=aux;
  13.                   trocou=1;
  14.           }
  15.           }
  16.           }
  17.           for(i=0;i<=3;i++){
  18.               printf("%d\n",n[i]);
  19.           return 0;
  20. }
Advertisement
Add Comment
Please, Sign In to add comment