fork download
  1. #include <stdio.h>
  2.  
  3. int main(void) {
  4. // your code goes here
  5. int data[8] = {3, -10, 6, 0, 2, -1, 8, 5};
  6. int count, i, j;
  7. int max=data[0],second=data[1];
  8. for(i=2;i<8;i++){
  9. if(data[i]>max){
  10. second=max;
  11. max=data[i];
  12. }
  13. else if(data[i]>second)
  14. second=data[i];
  15. }
  16. printf("%d",second);
  17.  
  18.  
  19. return 0;
  20. }
  21.  
Success #stdin #stdout 0.01s 5288KB
stdin
Standard input is empty
stdout
6