Dcoder icon

Least Significant Bit @ Dcoder

By Lochard | As a newbie programmer | 14 Apr 2023


Title: Least Significant Bit

Problem: In mathematics and digital electronics, a binary number is a number expressed in the base-2 numeric system or binary numeric system, which uses only two symbols: typically 0 (zero) and 1 (one). The least significant bit (LSB), is the lowest bit in a series of numbers in binary. The LSB is located at the far right of a binary string. For example, in the binary number: 00111001, the least significant bit is the far right -> 1. John wants to know whether the given numbers has LSB equal to 1 or not.

Input: The first line of input contains a single integer T denoting the number of test cases.

Each test case will have one integer A.

Output: For each test case, print "Yes" if LSB is equal to 1 else print "No", without the double quotes.

Constraints: 1 ≤ T ≤ 100

1 ≤ A ≤ 1000

Sample Input: 2

2

1

Sample Output: 

No

Yes

for i in range(int(input())):
  print('Yes' if int(input()) & 1 else 'No')

How do you rate this article?

2


Lochard
Lochard

20240228 Arrived in the UK for about 2 week. All my fears persist. Some are even getting worse. https://github.com/locharp/asylum_diary/


As a newbie programmer
As a newbie programmer

Sharing entry level codes. My snippets on GitHub https://github.com/locharp/code-snippets

Send a $0.01 microtip in crypto to the author, and earn yourself as you read!

20% to author / 80% to me.
We pay the tips from our rewards pool.