fork download
  1. #include <stdio.h>
  2.  
  3. int main(){
  4.  
  5. int a[8], num, max = 0;
  6.  
  7. for(int i=0; i<9; i++){
  8. scanf("%d", &a[i]);
  9. }
  10.  
  11. for(int i=0; i<9; i++){
  12. if(a[i]>max){
  13. max = a[i];
  14. num = ++i; //변수에 넣을 때 최대값 번호를 +1
  15. }
  16. }
  17. printf("%d\n%d", max, num);
  18.  
  19. return 0;
  20. }
Success #stdin #stdout 0s 5276KB
stdin
1
9
2
3
4
5
6
7
8
stdout
8
9