Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- namespace zad_12
- {
- class zad_12
- {
- static void Main(string[] args)
- {
- Console.Write("entering nomber - n: ");
- int n = int.Parse(Console.ReadLine());
- Console.WriteLine();
- Console.Write("enter the nomber on position - p: ");
- int p = int.Parse(Console.ReadLine());
- Console.WriteLine();
- if ((p >= 0) && (p <= 31))
- {
- int constanta = 1;
- int newInt = n >> p;
- bool newBool = newInt == constanta;
- Console.WriteLine(newBool);
- }
- else
- {
- Console.WriteLine("Enter the value 'p' - 0...31");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment