编写一个程序,输出以下逻辑表达式的值。假定:“int a=3,b=4,c=5,x,y;”。

编写一个程序,输出以下逻辑表达式的值。假定:“int a=3,b=4,c=5,x,y;”。(1)a+b>c&&b==c
(2)a||b+c&&b-c
(3)!(a>b)&&!c||1
(4)!(x=a)&&(y=b)&&0
(5)!(a+b)+c-1&&b+c/2

#include <stdio.h>
void main()
{
int a=3,b=4,c=5,x,y;
printf("%d  ",a+b>c&&b==c);
printf("%d  ",a||b+c&&b-c);
printf("%d  ",!(a>b)&&!c||1);
printf("%d  ",!(x=a)&&(y=b)&&0);
printf("%d",!(a+b)+c-1&&b+c/2);
}

运行结果:

温馨提示:答案为网友推荐,仅供参考
第1个回答  2017-03-06
(1)0、(2)1、(3)1、(4)0、(5)1。
相似回答