Advertisement
Guest User

Untitled

a guest
Sep 8th, 2015
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.67 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. int main ()
  5. {
  6.     int N1, N2, N3, MAIOR, SEGUNDO_MAIOR;
  7.     printf ("Numeros: ");
  8.     scanf ("%d%d%d", &N1, &N2, &N3);
  9.    
  10.     if (N1>N2)
  11.     {
  12.         if (N1>N3)
  13.         MAIOR = N1;
  14.        
  15.         if (N2>N3)
  16.         SEGUNDO_MAIOR = N2;
  17.        
  18.         else if (N3>N2)
  19.         SEGUNDO_MAIOR = N3;
  20.     }
  21.    
  22.     else if (N2>N1)
  23.     {
  24.         if (N2>N3)
  25.         MAIOR = N2;
  26.        
  27.         if (N1>N3)
  28.         SEGUNDO_MAIOR = N1;
  29.        
  30.         else
  31.         SEGUNDO_MAIOR = N3;
  32.     }
  33.    
  34.     else if (N3>N1)
  35.     {
  36.         if (N3>N2)
  37.             MAIOR = N3;
  38.        
  39.         if (N2>N1)
  40.             SEGUNDO_MAIOR = N2;
  41.                
  42.         else if (N1>N2)
  43.         SEGUNDO_MAIOR = N1;
  44.     }
  45.    
  46.     printf ("Maior: %d\nSegundo maior: %d\n", MAIOR, SEGUNDO_MAIOR);
  47.     system ("PAUSE");
  48.     return 0;
  49. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement