Huawei
Company
Programming
Technical
#include
#define mult(x,y) x*y
int main()
{
int a=5,b=5;
printf("%d",mult(a+b,a+b));
return 0;
}
Read Solution (Total 7)
-
- mult(a+b,a+b) will be replaced by 5+5*5+5.
First of all we will see the priority so * has more priority than +
so we get =5+25+5
Now all are + having same priority so we move from Left to Right.
so next=30+5;
and again
=35.
Finally we get 35 as correct answer.
And for those dear friends who got 100 as wrong answer , they just made a simple mistake. They start from left to right first without checking the priority.So be alert next time.Hare Krishna - 9 years agoHelpfull: Yes(8) No(0)
- Answer is 35
a+a*b+b - 9 years agoHelpfull: Yes(3) No(0)
- 35 is the ans...
- 8 years agoHelpfull: Yes(1) No(0)
- Answer is 35 not 100
- 9 years agoHelpfull: Yes(0) No(0)
- how can you explain please
- 9 years agoHelpfull: Yes(0) No(0)
- ans is 100
- 9 years agoHelpfull: Yes(0) No(1)
- ANS :35
multi: a+(b*a)+b=5+(5*5)+5
=35 - 9 years agoHelpfull: Yes(0) No(0)
Huawei Other Question