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 | #define _CRT_SECURE_NO_WARNINGS #include <stdio.h> int main(void) { int money, price, change; printf("ÅõÀÔÇÑ µ·: "); scanf("%d", &money); printf("¹°°Ç°ª: "); scanf("%d", &price); change = money - price; printf("°Å½º¸§µ·: %d\n\n", change); int coin100s = change / 100; // °Å½º¸§µ·¿¡¼ 100¿ø Â¥¸®ÀÇ °³¼ö °è»ê change = change % 100; // °Å½º¸§µ·¿¡¼ 100¿ø Â¥¸®¸¦ ³»ÁÖ°í ³²Àº µ· int coin10s = change / 10; // °Å½º¸§µ·¿¡¼ 10¿ø Â¥¸®ÀÇ °³¼ö °è»ê change = change % 10; // °Å½º¸§µ·¿¡¼ 10¿ø Â¥¸®¸¦ ³»ÁÖ°í ³²Àº µ· printf("100¿ø µ¿ÀüÀÇ °³¼ö: %d\n", coin100s); printf("10¿ø µ¿ÀüÀÇ °³¼ö: %d\n", coin10s); return 0; } | cs |