Advertisement
Marcos_Carvalho

quest 3 la

Apr 17th, 2019
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.34 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. int main ()
  4. {
  5.  
  6.     float a[5], maior, seg;
  7.  
  8.  
  9.     for(int i=0; i < 5 ; i++){
  10.         scanf("%f", &a[i]);
  11.     }      
  12.  
  13.     for(int i=0; i < 5 ; i++){
  14.         if( i == 0){
  15.    
  16.             maior =a[0];
  17.             seg= a[1]; 
  18.         }      
  19.        
  20.         if( maior < a[i]){
  21.    
  22.             seg=maior;
  23.             maior=a[i];
  24.         }
  25.     }
  26.  
  27.  
  28.  
  29.     printf("%f \t segundo %f", maior, seg);
  30.    
  31.     return 0;
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement