帮忙做几道C语言的题

来源:百度知道 编辑:UC知道 时间:2024/05/25 23:00:30
1.编写程序实现产品保修额的计算。如果本公司的产品,则使用期在1年(含1年)以内,免收保修额;使用期在1年以上并且在8年以下(含8年),收取保修额50元;使用期在8年以上,收取保修额10元。如果不是本公司的产品,则一律收取保修额200元。根据用户输入的信息,计算保修额。
2.有一人不小心打碎了一位妇女的一篮子鸡蛋,为了赔偿便询问篮子中有多少个鸡蛋,那妇女说,数量不清楚,只记得每次拿两个最后剩一个,每次拿三个最后剩2个,每次拿4个最后剩3个,每次拿5个最后剩4个。若一个鸡蛋0.4元,应至少应赔偿多少钱?
3输入长、宽、高,计算长方体的体积。
4输入一个摄氏温度值,要求输出华氏温度值,转换公式为f=9/5*C+32,其中C表示摄氏温度表示华氏温度.
5计算4!的值,在此基础上再计算5!的值.

用C++也行

题1:
#include<stdio.h>
int main()
{
int year=0,money=0,temp=0;
printf("Please input product witch place made in:\n");
printf("1------------------Made in Our company.\n");
printf("2------------------Made in other company.\n");
scanf("%d",&temp);
switch(temp)
{
case 1: printf("Please input how many year you use this company:\n");
scanf("%d",&year);
if(year>=0&&year<=1) {money=0; printf("Protect to fix a fee is %d\n",money);}
else if(year>1&&year<=8){money=50;printf("Protect to fix a fee is %d\n",money);}
else {money=10;printf("Protect to fix a fee is %d\n",money);}
break;
case 2: money=200;
printf("Protect to fix a fee is %d\n",money);
break;
default: printf("input error!\n");
}