3.
#include " "
void main()
{
int a=10,b=20,x;
if (10<20)
x=a;
else
x=b; printf("%d\n",x);
}
4.
#include " "
void main()
{
int a=30,b=20,x;
if (30<20)
x=a;
else
x=b; printf("%d\n",x);
}
1.
#include " "
void main()
{
int a=10,b=20,x;
if (a<b)
x=10;
x=20;
printf("%d\n",x);
}
2.
#include " "
void main()
{
int a=30,b=20,x;
if (a<b)
x=a;
x=b;
printf("%d\n",x);
}
作业
2.输入二个整数,将其中最大的数输出。100 500
3.输入二个整数,按由大到小顺序输出。500 100
500 100
4.输入二个整数,按由小到大顺序输出。
if与if-else比较 来自淘豆网www.taodocs.com转载请标明出处.