c/기초

정올 160 : 배열2-형성평가1

phantom0219 2019. 1. 24. 19:00



My Solution


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#include<stdio.h>
int main(void){
    int arr[10]={0,};
    int input;
    int i;
    for(i=0;i<10;i++){
        scanf("%d",&input);
        if(input<1||input>6){
            return 0;
        }
        arr[input-1]++;
    }
    for(i=1;i<7;i++){
        printf("%d : %d\n", i, arr[i-1]);
    }
    return 0;
}
cs


반응형