#include <stdio.h>
#include <stdlib.h>

int main(int argc, char *argv[]) {

int price;
float discounts, total;

printf("老闆請問多少錢?\n");


 //取記憶體price的數值
scanf("%i", &price);

printf("老闆請問打幾折?\n");
scanf("%f", &discounts);

 //算出total價格
total = price*discounts/10;

//取小數點後2位
printf("打 %.2f 折後為%f", discounts, total);

return 0;
}
文章標籤
全站熱搜
創作者介紹
創作者 kenohya 的頭像
kenohya

One Note with Two Memories

kenohya 發表在 痞客邦 留言(0) 人氣(8)