BlackBerry

  www.blackberry.com
Work in HR? Unlock Free Profile

BlackBerry Embedded Systems Software Developer Interview Question

I interviewed in Ottawa, ON (Canada) and was asked:
"Write a function that will return x*7 without using multiplication?"
Add Tags [?]
Answer

Part of a Embedded Systems Software Developer Interview Review - one of 383 BlackBerry Interview Reviews

Answers & Comments

0
of 1
vote
int func(int x)
{
  return (x<3)-x;
}
- Interview Candidate on Jan 16, 2012
0
of 0
votes
You could either do this by macro or inline (it usually would be inlined).
inline int mulby7(int x)
{
    return (x << 3) - x;
}
- I.S on Jan 26, 2012

To comment on this question, Sign In with Facebook or Sign Up

Tags are like keywords that help categorize interview questions that have something in common.