C 练习实例51

C语言教程评论

C 练习实例51

题目:学习使用按位与 &。

程序分析:0&0=0; 0&1=0; 1&0=0; 1&1=1 。文章源自公式库网-https://www.gongshiku.com/html/202112/c-lianxishili51.html

实例

#include <stdio.h>
int main()
{
    int a,b;
    a=077;
    b=a&3;
    printf("a & b(decimal) 为 %d \n",b);
    b&=7;
    printf("a & b(decimal) 为 %d \n",b);
    return 0;
}

以上实例输出结果为:文章源自公式库网-https://www.gongshiku.com/html/202112/c-lianxishili51.html

a & b(decimal) 为 3 
a & b(decimal) 为 3
文章源自公式库网-https://www.gongshiku.com/html/202112/c-lianxishili51.html文章源自公式库网-https://www.gongshiku.com/html/202112/c-lianxishili51.html
运营不易,
感谢支持!
weinxin
我的微信
我的微信公众号
我的微信公众号扫一扫
weinxin
我的公众号
 最后更新:2021-12-7
公式库网
  • 本文由 公式库网 发表于 2021年12月6日20:39:13
  • 转载请务必保留本文链接:https://www.gongshiku.com/html/202112/c-lianxishili51.html

发表评论