Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

what is the purpose of the code, and is there any problem
with the code?

int f( int n, int l, int r )
{ return (n << l) >> r; }

Answer Posted / senthil

f returns (n * 2^(l-r))

n<<l => n * 2^l
(n<<l)>>r => (n * 2^l)/(2^r)=>(n * 2^(l-r))

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the purpose of & in scanf?

1032


What is non linear data structure in c?

987


What is a nested loop?

1097


Write a Program to find whether the given number or string is palindrome.

1249


What do you mean by c what are the main characteristics of c language?

1002


What is quick sort in c?

1049


Explain About fork()?

1081


Is fortran still used in 2018?

1006


How can I change their mode to binary?

1075


Is c still relevant?

1054


Do you have any idea about the use of "auto" keyword?

1061


What is null pointer constant?

1098


What are the types of variables in c?

999


What is typedef?

1365


Can you please explain the difference between syntax vs logical error?

1149