3 votes 3 votes Choose the correct operators to fill in the blanks: int i,j,k; i=1;j=2;k=3; printf("%d",i___5___j___2____k); Output is: $2$ + % – + * / – + + % + / * % – / Programming in C tbb-programming-2 + – Bikram asked May 14, 2017 edited Aug 19, 2019 by Counsellor Bikram 299 views answer comment Share Follow See all 0 reply Please log in or register to add a comment.
Best answer 2 votes 2 votes precedence *,/,% L->R +,- L->R A) i+5%j-2+k i+1-2+k = 2-2+k = 0+k = 3 B) i * 5 / j - 2 + k 5/j-2+k = 2-2+k = 0+k = 3 C) i +5% j +2 /k i+1+2/k = i+1+0 = 2 D) i * 5% j -2/ k i*5 %2 -2/k =5%2 - 2/k = 1 - 2/3 = 1 - 0 = 1 So, answer is option C . Learner_jai answered Jun 11, 2017 selected Jun 12, 2017 by Bikram Learner_jai comment Share Follow See all 4 Comments See all 4 4 Comments reply Bikram commented Jun 12, 2017 reply Follow Share @jai Sorry, output would be 2 , can you check it now ? 1 votes 1 votes Learner_jai commented Jun 12, 2017 reply Follow Share @Bikram sir , still i am getting 2 in option C as well as in D 1 votes 1 votes Bikram commented Jun 12, 2017 reply Follow Share @jai For option D * % - / i * 5% j- 2 /k = (i * 5) %j - 2 / k =( (1 * 5 ) % 2 ) - (2 /k ) = (5 % 2 ) - (2/k) = 1 - ( 2/3) = 1 - 0 = 1 so for option D we are getting 1 . Hence for only option C , we get value 2 . 2 votes 2 votes VIKRAM KASANA commented Dec 20, 2017 reply Follow Share sir why you putting (2/3) to zero ?? 0 votes 0 votes Please log in or register to add a comment.