Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int main() {
- float price;
- printf("請輸入價格:");
- scanf("%f", &price);
- float d;
- if(price>0 && price<=1000){
- d=1.0;
- } else if(price>1000 && price<=2000){
- d=0.9;
- } else if(price>2000 && price<=5000){
- d=0.85;
- } else if(price>5000){
- d=0.8;
- } else{
- printf("錯誤!\n");
- d=0.0;
- }
- price*=d;
- printf("折扣後價格為%d\n",(int)price);
- return 0;
- }
Add Comment
Please, Sign In to add comment