雖然不一定很好
但是最原始的要求已經達到了
想再改善的人請自己再加油.. :)
#include<stdio.h>
#define GRAM_PER_OUNCE 28.35
#define OUNCE_PER_POUND 16.00
int main (void) {
double gram,ounce;
long pound;
printf("Insert the value of grams ~> ");
scanf("%lf",&gram);
ounce = gram / GRAM_PER_OUNCE;
pound = ounce / OUNCE_PER_POUND;
ounce = ounce - pound * OUNCE_PER_POUND;
printf("That equals to %ld pound, %f ounce.\n",pound,ounce);
return 0;
}
--
●●●●●●●●●●●
● 浪 有高有低 ●
● 海水 依舊是 海水 ●
● 生活 有苦有樂 ●
● 心 依舊是 心 ●
●●●●●●●●●●●
--
※ 發信站: 批踢踢實業坊(ptt.twbbs.org)
◆ From: nlpc11.csie.ntu