程式作業 第6題 for 四子一丙
#include <stdio.h> #include <stdlib.h> int main(void) { int num; float fifty, ten, five; printf("請輸入您的換幣金額:"); scanf("%d",&num); 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); system("pause"); return(0); }
留言
張貼留言