wingman007 icon

BitPosition

wingman007 | PRO | 09/15/25 08:27:52 AM UTC | 0 ⭐ | 13991 👁️ | Never ⏰ | [BitPosition]
C# |

370 B

|

Software

|

0 👍

/

0 👎

class BitPosition
{
    static void Main() {
        Console.Write("Input a number n:");
        int number = int.Parse(Console.ReadLine());
 
        Console.WriteLine("Input position p(0 the right bit):");
        int p = int.Parse(Console.ReadLine());
 
        int bit = (number >> p) & 1;
 
        Console.WriteLine($"On posion {p} we have: {bit}");
    }
}
 

Comments

  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎

    
        
  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎