write a c program to check weather a particluar bit is set
or not?
Answer Posted / abdur rab
#include <stdio.h>
int main ()
{
int variable = 6;
int position = 3;
char array [2][10] = {"NOT SET", "SET"};
// check the wheather the second bit is set
printf ( "\n The bit is %s",
array [ ( variable & ( 1 << (
position - 1 ) ) ) / position ] );
return ( 0 );
}
| Is This Answer Correct ? | 2 Yes | 3 No |
Post New Answer View All Answers
What is a dynamic array in c?
What is array in c with example?
Explain the difference between ++u and u++?
What is the difference between %d and %i?
Is fortran still used today?
What is the condition that is applied with ?: Operator?
How do I get an accurate error status return from system on ms-dos?
any "C" function by default returns an a) int value b) float value c) char value d) a & b
How can you read a directory in a C program?
How can you restore a redirected standard stream?
What is the right way to use errno?
Are pointers really faster than arrays?
In c language can we compile a program without main() function?
The program will first compute the tax you owe based on your income. User is prompted to enter income. Program will compute the total amount of tax owed based on the following: Income Tax 0 - $45,000 = 0.15 x income $45,001 - $90,000 = 6750 + 0.20 x (income – 45000) $90,001 - $140,000 = 15750 + 0.26 x (income – 90000) $140,001 - $200,000 = 28750 + 0.29 x (income – 140000) Greater than $200,000 = 46150 + 0.33 x (income – 200000) Dollar amounts should be in dollars and cents (float point numbers with two decimals shown). Tax is displayed on the screen.
1.int a=10; 2.int b=20; 3. //write here 4.b=30; Write code at line 3 so that when the value of b is changed variable a should automatically change with same value as b. 5.