Advertisement
tockata

Operators, Expressions and Statements - 5 задача

Mar 18th, 2014
151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.48 KB | None | 0 0
  1. using System;
  2.  
  3.  
  4.     class CheckThirdBit
  5.     {
  6.         static void Main()
  7.         {
  8.             Console.Write("Enter your number: ");
  9.             int a = int.Parse(Console.ReadLine());
  10.             int b = 8;
  11.             if ((a & b) == 8)
  12.             {
  13.                 Console.WriteLine("The third bit of number {0} is 1.", a);
  14.             }
  15.             else
  16.             {
  17.                 Console.WriteLine("The third bit of number {0} is 0.", a);
  18.             }
  19.         }
  20.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement