Console算法[运算符]学习使用按位与 &

ylbtech-Arithmetic:Console-算法[运算符]-学习使用按位与 &
 
1.A,Demo(案例)

 【程序51】
题目:学习使用按位与 & 。   
1.程序分析:0&0=0; 0&1=0; 1&0=0; 1&1=1

1.B,Solution(解决方案)
using System;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            int a, b;
            a = 077;
            b = a & 3;
            Console.WriteLine("The a & b(decimal) is {0}",b);
            b &= 7;
            Console.WriteLine("The a & b(decimal) is {0}",b);
        }
    }
}
1.C,Execution Result(运行结果)
The a & b(decimal) is 1
The a & b(decimal) is 1
请按任意键继续. . .
warn 作者:ylbtech
出处:http://ylbtech.cnblogs.com/
本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。
原文地址:https://www.cnblogs.com/ylbtech/p/3064167.html