字符串要用双引号,输出要用%s而不是%c
示例代码如下
有帮助望采纳~
#include <stdio.h>
#include <math.h>
int main()
{
double a, b, c, d, e, f;
char flag[2][20] = {"yes", "no"};
scanf("%lf%lf%lf", &a, &b, &c);
d = pow(a, 2);
e = pow(b, 2);
f = pow(c, 2);
if ((d + e == f) || (d + f == e) || (e + f == d))
printf("%s\n", flag[0]);
else
printf("%s\n", flag[1]);
return 0;
}
输入double型要用%lf格式
#include <stdio.h>
#Include <math.h>
int main()
{
double a,b,c,d,e,f;
char *flag = NULL;
scanf("%lf%lf%lf",&a,&b,&c);
d=pow(a,2);
e=pow(b,2);
f=pow(c,2);
if((d+e==f) || (d+f==e) || (e+f==d))
flag = "yes";
else
flag = "no";
printf("%s\n",flag);
return 0;
}