본문 바로가기
정보과학

숫자카운터

by chaechaekim 2019. 5. 22.
#include<stdio.h>
int d[7];
int main()
{
	int n,t;
	scanf("%d", &n);
	
	for(int i=1; i<=n;i++)
	{
		scanf("%d", &t);
		d[t]+=1;
	}
	
	for(int i=1; i<=6; i++)
		printf("%d ", d[i]);
	
	printf("\n");
}

/*

10
4 3 2 5 3 1 4 6 2 3
1 2 3 2 1 1

--------------------------------
Process exited after 8.291 seconds with return value 0
계속하려면 아무 키나 누르십시오 . . .

*/

'정보과학' 카테고리의 다른 글

문자 shift  (0) 2019.05.31
2진수로 변환하기  (0) 2019.05.24
숫자 맞히기 게임  (0) 2019.05.17
중첩반복을 이용한 숫자 삼각형 출력  (0) 2019.04.26
do-while문을 이용한 소인수 분해  (0) 2019.04.12

댓글