逻辑AND运算符 [英] Logical AND operator

查看:126
本文介绍了逻辑AND运算符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我与逻辑运算符有点糊涂了。
我有这两条线code的。在这里, NUM Ĵ都是int类型。我有其中两个条件都满足的情况下,但我不知道为什么它不打印Ĵ的价值。任何人都可以指出错误?先谢谢了。

 如果(K == 1安培;试验#引用%j == 0)
    的printf(%D,J);


解决方案

在简单的英语,前pression K == 1安培;&安培; NUM引用%j == 0 为真,当且仅当 K 等于1 从该分 NUM Ĵ余0没有更多的,我可以说。

I am little confused with logical AND operator. I have these 2 lines of code. Here num and j are both int. I have a situation where both the conditions are satisfied, but I don't know why it's not printing the value of j. Can anybody point out the mistakes? Thanks in advance.

if(k==1 && num%j==0)
    printf("%d",j);

解决方案

In plain English, the expression k == 1 && num % j == 0 is true if and only if k equals 1 and the remainder from dividing num by j is 0. Not much more I can say.

这篇关于逻辑AND运算符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆