从键盘读入两个实数,编程计算并输出它们的平方和,要求使用数学函数pow(x,y)计算平方值,输出结果保留2位小数。 程序中所有浮点数的数据类型均为float。
#include<stdio.h>
#include<math.h>
int main()
{
float x,y;
printf("Please input x and y:\n");
scanf("%f,%f",&x,&y);
printf("ans=%.2f\n",pow(x,2.0)+pow(y,2.0));
return 0;
}