c 语言运算有关问题,求帮忙
c 语言运算问题,求帮忙
#include <stdio.h>
void main()
{
int a,b,c,max,min;
printf("input three number:");
scanf("%d,%d,%d",&a,&b,&c);
if(a>b);
{
max=a;
min=b;
}
else
{ max=b;
min=a;
}
if(max<c);
{
max=c;
else if(min>c)
{
min=c;
}
printf("max=%d,min=%d\n",max,min);
}
Compiling...
a.c
C:\Users\Dell\Desktop\aaaa\a.c(13) : error C2181: illegal else without matching if
C:\Users\Dell\Desktop\aaaa\a.c(20) : error C2181: illegal else without matching if
C:\Users\Dell\Desktop\aaaa\a.c(28) : fatal error C1004: unexpected end of file found
执行 cl.exe 时出错.
请问这个问题错在哪??、求帮忙
------解决思路----------------------
if(a>b);
if(max<c);
去掉分号
#include <stdio.h>
void main()
{
int a,b,c,max,min;
printf("input three number:");
scanf("%d,%d,%d",&a,&b,&c);
if(a>b);
{
max=a;
min=b;
}
else
{ max=b;
min=a;
}
if(max<c);
{
max=c;
else if(min>c)
{
min=c;
}
printf("max=%d,min=%d\n",max,min);
}
Compiling...
a.c
C:\Users\Dell\Desktop\aaaa\a.c(13) : error C2181: illegal else without matching if
C:\Users\Dell\Desktop\aaaa\a.c(20) : error C2181: illegal else without matching if
C:\Users\Dell\Desktop\aaaa\a.c(28) : fatal error C1004: unexpected end of file found
执行 cl.exe 时出错.
请问这个问题错在哪??、求帮忙
------解决思路----------------------
if(a>b);
if(max<c);
去掉分号