#include <stdio.h>
float H(float x, float y)
{
return x + y;
}
float J(float x, float y)
{
return x * y;
}
int main()
{
float a, b;
printf("请输入两个实数\n");
scanf("%f %f", &a, &b);
printf("和为%f\n积为%f\n", H(a, b), J(a, b));
return 0;
}

本文介绍了一个使用C语言编写的简单计算器程序,该程序能够接收用户输入的两个浮点数,并计算这两个数的和与积。通过定义两个函数H()和J()分别实现了加法和乘法的功能。
#include <stdio.h>
float H(float x, float y)
{
return x + y;
}
float J(float x, float y)
{
return x * y;
}
int main()
{
float a, b;
printf("请输入两个实数\n");
scanf("%f %f", &a, &b);
printf("和为%f\n积为%f\n", H(a, b), J(a, b));
return 0;
}

662

被折叠的 条评论
为什么被折叠?