键盘输入两个整数,然后:
(1)若任意一个数在10~100(包括10和100)之间,则输出它们,否则不输出;
(2)不管什么情况,程序的最后都输出:End
不知道怎么同时输出两个数,求大神指点
#include <stdio.h>
int main()
{
int a,b;
scanf("%d%d",&a,&b);
if((a>=10 &&a<=100)||(b>=10 &&b <=100))
{
printf("%d %d\n",a,b);
}
printf("End");
return 0;
}
运用逻辑运算符:&&,||
&&:表示且,符合两边都是true时返回true
||:表示或,符号两边只需要一边是true时返回true
下面是完整代码
#include <stdio.h>
int main(){
int a,b;
scanf("%d%d",&a,&b);
if((a>=10&&a<=100)||(b>=10&&b<=100))
printf("%d %d\n",a,b);
printf("End");
return 0;
}