---
title: "学习笔记习题3.3"
author: "xrtkong"
date: "2011-10-14T00:34:40Z"
tags: []
categories: ["编程语言"]
slug: "3-3"
draft: false
lastmod: "2011-10-14T00:34:40Z"
id: 1195546
url: "https://xrtkong.iteye.com/blog/1195546"
---

#include&lt;stdio.h&gt;  
#define price 5  
int main(){

   // const int price = 5 ;  
    int shuliang = 0 ;         
    printf(" 请输入一个数值！");  
     
    scanf("%d" ,&shuliang);

    if(shuliang &gt;= 20 ){  
        printf("%.2f",(float)shuliang *  0.9 * price );  
    }else if(shuliang &gt;= 50 ){  
            printf("%.2f",(float)shuliang *  0.7 * price );  
    }else{  
            printf("%d", shuliang * price );  
    }  
    return 0 ;  
}