Toggle nth bit in a given integer - num
Answers were Sorted based on User's Feedback
Answer / sanyam jain
#include<stdio.h>
int main()
{
int a,b;
printf("Enter the number to be flipped\n");
scanf("%d",&a);
printf("Enter which bit to be flipped: ");
scanf("%d",&b);
a = a^(1<<(b-1));
printf("Resultan number is %d\n",a);
}
| Is This Answer Correct ? | 6 Yes | 3 No |
Answer / banavathvishnu
#include<stdio.h>
#include<conio.h>
Togglebit(int k,int bit)
{
printf("after %d bit is toggled = %d",bit,(k^(1<<(bit-
1))));
return 1;
}
int main()
{
int i;
int bitno;
printf("enter the number \n");
scanf("%d",&i);
printf("enter the bit number to toggle \n");
scanf("%d",&bitno);
Togglebit(i,bitno);
getch();
return 1;
}
| Is This Answer Correct ? | 1 Yes | 4 No |
Linked list is a Linear or non linear explain if linear how it working as a non linear data structures
What is a union?
Input any no. and print all the the numbers that comes before it like this for e.g input = 4 0 01 012 0123 01234 plz answer it 2day
What is a 'null pointer assignment' error? Explain what are bus errors, memory faults, and core dumps?
What is the purpose of & in scanf?
Write a function expand(s1,s2) that expands shorthand notations like a-z in the string s1 into the equivalent complete list abc...xyz in s2 . Allow for letters of either case and digits, and be prepared to handle cases like a-b-c and a-z0-9 and -a-z. z-a:zyx......ba -1-6-:-123456- 1-9-1:123456789987654321 a-R-L:a-R...L a-b-c:abbc
HOW TO ANSWER IF ASKED " WHAT KIND OF A PERSON ARE YOU?" I NEED AN ANSWER THAT IMPRESS THE INTERVIEWER
Compare interpreters and compilers.
What is union and structure?
WRITE A C PROGRAM TO FIND SECOND BIGGEST VALUE FROM THE GIVEN VALUES
What are the parts of c program?
i need all types of question paper releted to "c" and other language.