程式作業 第7題 for 四子一丙
#include <stdio.h> #include <stdlib.h> int main(void) { int num = 50; float fifty, ten, five; while(num >= 50) { printf("請輸入您的換幣金額:"); scanf("%d",&num); if(num >= 50) { fifty = num / 50; num %= 50; printf("可兌換:50圓%2.0f個\n",fifty); ten = num / 10; num %= 10; printf(" 10圓%2.0f個\n",ten); five = num / 5; num %= 5; printf(" 5圓%2.0f個\n",five); printf(" 1圓%2d個\n",num); num = 50; } } system("pause"); return(0); }
留言
張貼留言