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 ? | 85 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 |
Develop a program that computes the new price of an item. The program should receive a character variable colour and a double precision floating-point variable price from the user. Discount rate is determined based on the colour of the discount sticker, as shown in the following table. An error message should be printed if an invalid colour has been entered
write a c program in such a way that if we enter the today date the output should be next day's date.
how can i write a program that prints out a box such that whenever i press any key8(coordinate number) on the keyboard, the box moves.
#include<stdio.h> int f(int,int); int main() { printf("%d",f(20,1)); return 0; } int f(int n,int k) { if(n==0) return 0; else if(n%2)return f(n/2,2*k)+k; else return f(n/2,2*k)-k; } how this program is working and generating output as 9....?
The postoder traversal is 7,14,3,55,22,5,17 Then ur Inorder traversal is??? please help me on this
Why main is not a keyword in c?
5. distance conversion: Convert a distance from miles to kilometers .there are 5280 feets per mile,12 inches per foot .2.54 centimeters per inch and 100000centimeters per kilometer
how is the examination pattern?
difference between object file and executable file
What are the phases in s/w developed life cycle? wat is the diff b/w stack & queue...where do we use stack
Is reference used in C?
how many error occurs in C language ?