Rohyoohyun / C

0 stars 0 forks source link

2562 최댓값(배열활용) #19

Open Rohyoohyun opened 3 months ago

Rohyoohyun commented 3 months ago
#include <stdio.h>
int main(){
    int max=0;

    int number[9] = {0};
    for(int i=0; i<9; i++)
        scanf("%d", &number[i]);

    int cnt;
    for(int i=0; i<9; i++){
        if(max < number[i]){
            max = number[i];
            cnt = i+1;
        }
    }
    printf("%d\n%d", max, cnt);

    return 0; 
}