Saturday, June 13, 2020

least significant bit is 0 or 1


The program must accept an integer N as the input. The program must print YES if the least significant bit of N is set as 1. Else the program must print NO as the output.

Example Input/Output 1:
Input:
11

Output:
YES

solution:
int main()
{
int a;
scanf("%d",&a);
if(a&1==1){
    printf("Yes");}
else{
    printf("no");
}
}

No comments:

Post a Comment

MFIB Comma Separated Integers

Fill in the blanks with code so that the program must accept three integers separated by a space and print them separated by a comma as the ...