which is the easy way to divide any integer by 2?

Answers were Sorted based on User's Feedback



which is the easy way to divide any integer by 2?..

Answer / rahul

int i = 10;
i = i >> 1;

Is This Answer Correct ?    15 Yes 0 No

which is the easy way to divide any integer by 2?..

Answer / saranya

if s=10
s=s>>1

Is This Answer Correct ?    5 Yes 1 No

Post New Answer

More C++ General Interview Questions

What are the syntactic rules to be avoid ambiguity in multiple inheritance?

0 Answers  


Given the following seqment of code containing a group of nested if instructions: y = 9; if ((x==3) || (x == 5)) y++; else if (x == 2) y *= 2; else if (x == ) y-= 7; else y = 8; if the value of x is 4 before the nested IFs are executed, what is the value of y after the nested IFs are executed?

0 Answers  


What are the storage qualifiers?

0 Answers  


Is swift a good first language?

0 Answers  


what is Member Functions in Classes?

0 Answers  






How do you establish an is-a relationship?

0 Answers  


Given the following function definition: int doit(int &x, int y, int &z) { x = 3*x; y = y + 5; z = x+y; return z - 4; } int a = 5, b = 7, c = 9, d = 11; d = doit(a,b,c);

2 Answers  


What is c++ hiding?

0 Answers  


Can java be faster than c++?

0 Answers  


List the features of oops in c++?

0 Answers  


Why do we use templates?

0 Answers  


What is the syntax for a for loop?

0 Answers  


Categories