fork download
  1. #include <stdio.h>
  2.  
  3. int main()
  4. {
  5. int num, max = 0, result = 0;
  6. int s[9] = {};
  7.  
  8.  
  9. for(int i=0; i<9; i++){
  10.  
  11.  
  12. scanf("%d", &num);
  13.  
  14. s[i] = num;
  15.  
  16. }
  17.  
  18. max = s[0];
  19.  
  20. for(int i=0; i<9; i++){
  21.  
  22. if(max < s[i]){
  23.  
  24. max = s[i];
  25. result = i+1;
  26.  
  27. }
  28. }
  29.  
  30. printf("%d\n", max);
  31. printf("%d", result);
  32.  
  33. return 0;
  34. }
  35.  
Success #stdin #stdout 0.01s 5304KB
stdin
99
29
38
12
57
74
40
85
61
stdout
99
0