其他分享
首页 > 其他分享> > 实验3-10 计算油费

实验3-10 计算油费

作者:互联网

#include<stdio.h>
#include<math.h>
int main()

{
   int a,b;
   char op;
   double d;
   scanf("%d %d %c",&a,&b,&op);
   if(op=='m'){
   	if(b==90){
	   
   	d=a*6.95*0.95;}
   	else if(b==93){
   		d=a*7.44*0.95;
	   }
	   else{
	   	d=a*7.93*0.95;
	   }
   }
   if(op=='e'){
   	if(b==90){
	   
   	d=a*6.95*0.97;}
   	else if(b==93){
   		d=a*7.44*0.97;
	   }
	   else{
	   	d=a*7.93*0.97;
	   }
   }
   
   printf("%.2f",d);
   
   return 0;
}

 

标签:10,6.95,int,else,油费,实验,0.95,0.97,op
来源: https://blog.csdn.net/weixin_62519708/article/details/122275666