c语言
10.编写程序,输入两个实数x ,y ,输出x除以y的余数。#include<stdio.h>
int main()
{
double x,y,z;
printf("请输入两个实数x,y:");
scanf("%l%l",x,y);
z=x%y;
printf("x除以y的余数是:%l",&z);
return 0;
}
G:\新建文件夹\第十题.cpp(7) : error C2296: '%' : illegal, left operand has type 'double'
G:\新建文件夹\第十题.cpp(7) : error C2297: '%' : illegal, right operand has type 'double'
Error executing cl.exe. 更正:
scanf("%lf%lf",&x,&y);
printf("x除以y的余数是:%lf",z); #include<stdio.h>
int main()
{
double x,y,z;
printf("请输入两个实数x,y:");
scanf("%l%l",&x,&y);
z=x % y;
printf("x除以y的余数是:%lf",&z);
return 0;
} 晨曦到日暮 发表于 2018-1-9 21:05
#include
int main()
{
C:\Users\Administrator\Desktop\Cpp1.cpp(7) : error C2296: '%' : illegal, left operand has type 'float'
C:\Users\Administrator\Desktop\Cpp1.cpp(7) : error C2297: '%' : illegal, right operand has type 'float'
Error executing cl.exe.
还是有错误
页:
[1]