跪求3个简单的编程答案

来源:百度知道 编辑:UC知道 时间:2024/05/13 08:01:00
输出如下
第一题;Please enter the 1st number:1.23456
Please enter the 2nd number:6.54321
1.235 + 6.543 = 7.778
第二题:Please enter your name :Mary
Hello Mary!
Please enter the 1st number:1.2345
Please enter the 2nd number:2.3456
Please enter the 3rd number:3.4567
(1.235 + 2.346 + 3.457 )/ 3 = 2.346
第三题:
*************************************************************
Unit Conversion
*************************************************************
1. Change from centimeters to inches
2. Change from inches to centimeters
3. Change from centimeters to feet
4. Change from feet to centimeters
*************************************************************
Please choose a function(1-4):1
Please enter the length(cm):5
Result(in.):1.969

*************************************************************

1、
#include<stdio.h>
void main(void)
{
float a,b;

printf("Please enter the 1st number:");
scanf("%f",&a);
printf("Please enter the 2nd number:");
scanf("%f",&b);
printf("%0.3f+%0.3f=%0.3f\n",a,b,a+b);
}

2、

#include<stdio.h>
void main(void)
{
float a,b,c;
char s[80];

printf("Please enter your name :");
scanf("%s",s);
printf("Hello %s!\n",s);
printf("Please enter the 1st number:");
scanf("%f",&a);
printf("Please enter the 2nd number:");
scanf("%f",&b);
printf("Please enter the 3rd number:");
scanf("%f",&c);
printf("%0.3f+%0.3f+%0.3f=%0.3f\n",a,b,c,(a+b+c)/3);
}

3、

#include<stdio.h>
void main(void)
{