interview
Exam
Programming
Program
int i=5,j; j=i++ + ++i +i++; ans??
Read Solution (Total 3)
-
- i=5
So j = (i++) + (++i) + (i++) i ++ means postfix. Initially it wont change. After the operation only value will change to value +1 . ++i means prefix. Value will change to value +1 before operation
= 5 + (6+1) + (7)
= 19 - 9 years agoHelpfull: Yes(1) No(0)
- 20(j=5++ + ++5 + 5++ =(5+7+7)++=19++=20)
- 9 years agoHelpfull: Yes(0) No(0)
- ans is 19. 32 bit compiler then start calculation from right to left.5+7+7=19
- 9 years agoHelpfull: Yes(0) No(0)
interview Other Question
Let Say, We've got 3 Kinds of Fruits such are Banana (0.5Rs), Oranges (1Rs), Apple (5Rs) and 100Rs money.
Now I would like buy 100 Fruits of all 3 kinds for 100Rs.
So, I want you to display all the possible combinations of Fruits ratios.
Find Fruits Combination (Should include all of 3 fruit types) to get 100 fruits for 100 Rs.
1,7,7,7,7=100 use operators(+,-,/,*)but you should not combine the numbers..