Advertisement
rdsedmundo

[obi] carnaval.c

Apr 21st, 2013
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.52 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. int main()
  4. {
  5.     float a, b, c, d, e, all[4], aux, soma=0;
  6.     scanf("%f %f %f %f %f", &a, &b, &c, &d, &e);
  7.     all[0] = a; all[1] = b; all[2] = c; all[3] = d; all[4] = e;
  8.         for(int j=0; j<=4; j++){
  9.             for(int i=0; i<=3; i++)
  10.                 if(all[i]>all[i+1]){
  11.                     aux=all[i];
  12.                     all[i]=all[i+1];
  13.                     all[i+1]=aux;
  14.                 }
  15.         }
  16.     soma = all[1]+all[2]+all[3];
  17.  
  18.     printf("%2.1f", soma);
  19.  
  20.     return 0;
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement