x==1。因为这段代码写规整了是这样的——
if(a>7)//成立,所以执行if(b>8)if(b>8)//不成立,直接完成if(a>7)语句而跳出.
if(c>9)
x=3
#include <stdio.h>
int main()
{
int breathe, pulse
printf("Breathe: ")
scanf("%d", &breathe)
printf("Pulse: ")
scanf("%d", &pulse)
if (15 <= breathe &&breathe <=20
&&50 <= pulse &&pulse <= 70)
printf("sleeping\n")
else
printf("pretend\n")
return 0
}
我用的是笨方法:先把a分别与b,c,d相比较,最小的值赋给a,然后b与c,d比较,最小的给b,然后c与d比较,较小的赋给c#include<stdio.h>
void
main()
{
int
a,b,c,d,t
printf("please
input
four
number
:")
scanf("%d%d%d%d",&a,&b,&c,&d)
if(a>b)
{
t
=
a
a
=
b
b
=
t
}
if(a>c)
{
t
=
a
a
=
c
c
=
t
}
if(a>d)
{
t
=
a
a
=
d
d
=
t
}
if(b>c)
{
t
=
b
b
=
c
c
=
t
}
if(b>d)
{
t
=
b
b
=
d
d
=
t
}
if(c>d)
{
t
=
c
c
=
d
d
=
t
}
printf("%d
%d
%d
%d",a,b,c,d)
}