求各位大神把下面的C语言程序编码翻译成python语言,谢谢的!!急呀!!
#include<stdio.h>intmain(){intnum1,num2,num3;doublesum1,sum2,sum3,sum;chara[10],b[10]...
#include<stdio.h>
int main()
{
int num1,num2,num3;
double sum1,sum2,sum3,sum;
char a[10],b[10],c[10];
printf("please input the first thing you want to buy\n");
gets(a);
puts(a);
printf("please input the number you need\n");
scanf("%d\n",&num1);
sum1=num1*4.5;
printf("the price is %f\n",sum1);
printf("please input the second thing you want to buy\n");
gets(b);
puts(b);
printf("please input the number you need\n");
scanf("%d\n",&num2);
sum2=num2*5.5;
printf("the price is %f\n",sum2);
printf("please input the third thing you want to buy\n");
gets(c);
puts(c);
printf("please input the number you need\n");
scanf("%d\n",&num3);
sum3=num3*5.5;
printf("the price is %f\n",sum3);
sum=sum1+sum2+sum3;
printf("the final price is %f",sum);
return 0;
} 展开
int main()
{
int num1,num2,num3;
double sum1,sum2,sum3,sum;
char a[10],b[10],c[10];
printf("please input the first thing you want to buy\n");
gets(a);
puts(a);
printf("please input the number you need\n");
scanf("%d\n",&num1);
sum1=num1*4.5;
printf("the price is %f\n",sum1);
printf("please input the second thing you want to buy\n");
gets(b);
puts(b);
printf("please input the number you need\n");
scanf("%d\n",&num2);
sum2=num2*5.5;
printf("the price is %f\n",sum2);
printf("please input the third thing you want to buy\n");
gets(c);
puts(c);
printf("please input the number you need\n");
scanf("%d\n",&num3);
sum3=num3*5.5;
printf("the price is %f\n",sum3);
sum=sum1+sum2+sum3;
printf("the final price is %f",sum);
return 0;
} 展开
展开全部
price1 = 4.5
price2 = 5.5
price3 = 5.5
thing1 = raw_input('please input the first thing you wang to bug\n')
print thing1
num1 = int(raw_input('please input the number you need\n'))
print num1
print 'the price is %f' % float(num1*price1)
thing2 = raw_input('please input the first thing you wang to bug\n')
print thing2
num2 = int(raw_input('please input the number you need\n'))
print num2
print 'the price is %f' % float(num2*price2)
thing3 = raw_input('please input the first thing you wang to bug\n')
print thing3
num3 = int(raw_input('please input the number you need\n'))
print num3
print 'the price is %f' % float(num3*price3)
print 'the final price is %f' % float(num1*price1+num2*price2+num3*price3)
price2 = 5.5
price3 = 5.5
thing1 = raw_input('please input the first thing you wang to bug\n')
print thing1
num1 = int(raw_input('please input the number you need\n'))
print num1
print 'the price is %f' % float(num1*price1)
thing2 = raw_input('please input the first thing you wang to bug\n')
print thing2
num2 = int(raw_input('please input the number you need\n'))
print num2
print 'the price is %f' % float(num2*price2)
thing3 = raw_input('please input the first thing you wang to bug\n')
print thing3
num3 = int(raw_input('please input the number you need\n'))
print num3
print 'the price is %f' % float(num3*price3)
print 'the final price is %f' % float(num1*price1+num2*price2+num3*price3)
追问
谢谢你呀大神
本回答被提问者和网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
2015-12-10
展开全部
很愿意帮助你完成方面其他方式交流吗
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询