学习笔记习题2.3

/* programe exercise 2.3 */
#include<stdio.h>
int main(){
   
    float price_a = 3.5f ;
    float price_l = 5.5f ;
    int shuliang = 0 ;
    char Hhuaban = 'H' ;
    char putongban = 'P' ;
    char version ='0';
    float je = 0.00f ;

    printf(" enter the version H or P: \n");
    scanf("%c",&version) ;
    printf(" enter the shuliang you buy:\n");
    scanf(" %d",&shuliang);

    if(version == 'H'){
        je = price_l * (float) shuliang ;
    }else{
        je = price_a * (float) shuliang ;
    }

    printf(" the jin e is %.2f",je);
    return 0;

     

}

你可能感兴趣的:(学习笔记)