Advertisement
Vladimir76

задача 11

Dec 28th, 2013
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.76 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5.  
  6. namespace zad_11
  7. {
  8.     class zad_11
  9.     {
  10.         static void Main(string[] args)
  11.         {
  12.             Console.Write("Enter the value - n: ");
  13.             long n = long.Parse(Console.ReadLine());
  14.             Console.WriteLine();
  15.             Console.Write("Enter the value - p: ");
  16.             int p = int.Parse(Console.ReadLine());
  17.             Console.WriteLine();
  18.             long constanta = 1;
  19.             long newNomber = n >> p;
  20.  
  21.             Console.WriteLine(
  22.                 (newNomber == 1) & (constanta == 1) ? "position of the selected value of the bit is: 1" :
  23.                 "position of the selected value of the bit is: 0");
  24.  
  25.  
  26.         }
  27.     }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement