Advertisement
emmit

Maior valor sem Est. de rep.

Jul 31st, 2014
238
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.78 KB | None | 0 0
  1. // receba tres valores e mostre em ordem crescente sem estrutura de repetiçao.
  2.  
  3. #include <stdio.h>
  4. #include <conio.h>
  5.  
  6. int main(){
  7.    
  8.     int a, b, c;
  9.    
  10.     printf("digite os valores: \n");
  11.    
  12.     scanf("%d %d %d", &a, &b, &c);
  13.    
  14.     if(a <= b && a <= c){
  15.        
  16.         if(b <= c)         
  17.             printf("os valores ficarao a b c %d %d %d ", a, b, c);
  18.         else       
  19.             printf("os valores ficarao a  c b %d %d %d ", a, c, b);
  20.            
  21.        
  22.                
  23.     }else if(b<=a && b<=c){
  24.        
  25.         if(a<=c)
  26.             printf("os valores ficarao  b a c %d %d %d ", b, a, c);
  27.         else
  28.             printf("os valores ficarao b c a %d %d %d ", b, c, a);
  29.        
  30.        
  31.     }else{
  32.    
  33.              if(a<=b)
  34.                 printf("os valores ficarao c a b %d %d %d ", c, a, b);
  35.             else
  36.                 printf("os valores ficarao c b a %d %d %d ", c, b, a);
  37.    
  38.     }
  39.    
  40.        
  41.                        
  42.     getch();
  43.     return 0;
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement