main()
{
int x=5;
printf("%d %d %d\n",x,x<<2,x>>2);
}
Answers were Sorted based on User's Feedback
Answer / daniel
Indeed the correct answer is 5, 20, 1.
Explanation:
* the value of x is 5 so it will print out 5
* the value of x << 2, x shifted to left 2 times means x multiplied by 2 for 2 times, i.e. 5 * 2 * 2 = 20
* the value of x >> 2, x shifted to right 2 times so the result will be 5 / 2 / 2 = 5 / 4 = 1 (x is an int).
Is This Answer Correct ? | 84 Yes | 2 No |
Answer / anand h i
in printf functiton evaluation of variables start from
right to left so first it evaluates
x>>2
101 after right shift of 2 it will be 001=1
next it will evaluate
x<<2
1 after left shift of 2 it will be 100=4
at the last x=4
so answer is 4 4 1
Is This Answer Correct ? | 3 Yes | 13 No |
oh oh , sorry , i didnt see the value of x is 5....
4 4 1
than k u
Is This Answer Correct ? | 1 Yes | 11 No |
write a c program thal will find all sequences of length N that produce the sum is Zero, print all possible solutions?
main() { charx; while (x=0;x<=255;x++) printf("\nAscii value %d Character %c,x,x); }
exit () is used to a) exit () terminates the execution of the program itself b) exit () terminates the execution of the loop c) exit () terminates the execution of the block d) none of the above
Program to find larger of the two numbers without using if-else,while,for,switch
Design a program using an array that searches a number if it is found on the list of the given input numbers and locate its exact location in the list.
What is a string?
to get a line of text and count the number of vowels in it
What are the different types of data structures in c?
Define circular linked list.
wap in c to accept a number display the total count of digit
What is a pointer in c?
What's the best way to declare and define global variables?