Notice
Recent Posts
Recent Comments
Link
«   2025/07   »
1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31
Tags
more
Archives
Today
Total
관리 메뉴

이것저것

C언어 swea 1970 쉬운 거스름돈 본문

Language/C언어

C언어 swea 1970 쉬운 거스름돈

olivia-com 2020. 11. 19. 22:23

https://swexpertacademy.com/main/identity/anonymous/loginPage.do

 

SW Expert Academy

SW 프로그래밍 역량 강화에 도움이 되는 다양한 학습 컨텐츠를 확인하세요!

swexpertacademy.com

#include <stdio.h>

int main(void){
	int test_case, i,j, N;
	int arr[8] = {50000, 10000, 5000, 1000, 500, 100, 50, 10};
	int arr2[8];
	scanf("%d", &test_case);
	for(i = 0; i < test_case; i++){
		scanf("%d", &N);
		for(j = 0; j<8; j++){ 
		/*입력받은 N을 배열 arr의 수로 나눈
		몫은 num에 저장하고 나머지는 N에 저장*/ 
			int num = N;
			num = N / arr[j];
			N = N % arr[j];
			arr2[j] = num;
		}
		printf("#%d\n", i+1);
		for(j = 0; j<8; j++){
			printf("%d ", arr2[j]);
		}
		printf("\n");
	}
	return 0;
}
​

'Language > C언어' 카테고리의 다른 글

C언어 swea 2029  (0) 2020.11.20
C언어 swea 1938  (0) 2020.11.20
C언어 swea 1983 조교의 성적 매기기  (0) 2020.11.19
C언어 swea 1954 달팽이 숫자  (0) 2020.11.19
C언어 swea 2005 파스칼의 삼각형  (0) 2020.11.19