#include<stdio.h> void main() { int i,max,n,d;
#include<stdio.h>voidmain(){inti,max,n,d;doublek;inta[1000];max=0;while(scanf("%d",&n...
#include<stdio.h>
void main()
{
int i,max,n,d;
double k;
int a[1000];
max=0;
while(scanf("%d",&n)!=EOF)
{
for(i=0;i<n;i++)
{
scanf("%d",a[i]);
if(a[i]>max)
max=a[i];
}
k=max;
while(1)
{
for(i=0;i<n;i++)
{
if(k%a[i]==0)
d++;
}
if(d==n)
break;
k++;
}
printf("%lf\n",k);
}
}
出现了error c21:invalid operands for binary operation 该怎么解决? 展开
void main()
{
int i,max,n,d;
double k;
int a[1000];
max=0;
while(scanf("%d",&n)!=EOF)
{
for(i=0;i<n;i++)
{
scanf("%d",a[i]);
if(a[i]>max)
max=a[i];
}
k=max;
while(1)
{
for(i=0;i<n;i++)
{
if(k%a[i]==0)
d++;
}
if(d==n)
break;
k++;
}
printf("%lf\n",k);
}
}
出现了error c21:invalid operands for binary operation 该怎么解决? 展开
展开全部
我的报错和你的不一样。
我改了几个地方:
float->double
scanf里面的%f->%lf
你的weight后面的都写成了wight
#include<stdio.h>int main(void){ double weight; double value; printf("Are you worth your wight in rhodium?\n"); printf("Let's check it out.\n"); printf("Please enter your wight in pounds: "); scanf("%lf",&weight); value = 770 * weight * 14.5833; printf("Your wight in rhodium is worth $%.2f.\n",value); printf("You are easily worth that! If rhodium prices drop.\n"); printf("Eat more to maintain your value.\n"); return 0;}
我改了几个地方:
float->double
scanf里面的%f->%lf
你的weight后面的都写成了wight
#include<stdio.h>int main(void){ double weight; double value; printf("Are you worth your wight in rhodium?\n"); printf("Let's check it out.\n"); printf("Please enter your wight in pounds: "); scanf("%lf",&weight); value = 770 * weight * 14.5833; printf("Your wight in rhodium is worth $%.2f.\n",value); printf("You are easily worth that! If rhodium prices drop.\n"); printf("Eat more to maintain your value.\n"); return 0;}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询