+ means * and * means / and / means % what is the value of 2+3*5/7

This question is related to Accenture Interview

Showing Answers 1 - 71 of 71 Answers

marula siddesh

  • May 12th, 2005
 

7 is the answer, because 2*3=6,6/5=1.2 and 1.2%7=7

  Was this answer useful?  Yes

Ruchi

  • Jun 8th, 2005
 

1.2 is the answer, as 1.2 %7 = 1.2

  Was this answer useful?  Yes

Mubeen

  • Jul 2nd, 2005
 

what about the operator precedence? Doesnt % have precedence over * and /?

  Was this answer useful?  Yes

karthik

  • Jul 7th, 2005
 

what about the operator precedence? Doesnt % have precedence over * and /?  

  Was this answer useful?  Yes

kavita kanyal

  • Jul 7th, 2005
 

Ans: 1.2 as (2*3)/(5%7)=6/5=1.2 
 
comment:- % is having highest precedence of all.

here

  • Jul 16th, 2005
 

5:6::7:10::6:5 
25:30::21:30::36:30 
25::21::36

  Was this answer useful?  Yes

Jagdish Ahuja

  • Aug 17th, 2005
 

=(2*3)/(5%7)=17.14

krj & ikm

  • Sep 9th, 2005
 

(2*3)/(5%7)=1.2

  Was this answer useful?  Yes

ravi

  • Sep 29th, 2005
 

I think answer is 6 . Below is my explanation

step 1 -  2 * 3 / 5 % 7

step 2 -  2 * 3 / 1 as  ( 5 % 7 = 1)

step 3 - 2 * 3 (as 3 /1 = 3)

step 4 - 6 (as 2 * 3 = 6)

The precedense order is % / * if i am not wrong

  Was this answer useful?  Yes

Dheeraj Mehta

  • Oct 27th, 2005
 

Well.. depends whether u guyz are looking % as percentage or modulus operator

ravi Wrote:

I think answer is 6 . Below is my explanation

step 1 -  2 * 3 / 5 % 7

step 2 -  2 * 3 / 1 as  ( 5 % 7 = 1) 5%7 = 5 || 5%7= 0.35

step 3 - 2 * 3 (as 3 /1 = 3) Hence 2 * 3/5 || 2* 3/0.35

step 4 - 6 (as 2 * 3 = 6)

The precedense order is % / * if i am not wrong


  Was this answer useful?  Yes

Devanathan.J

  • Nov 17th, 2005
 

marula siddesh Wrote: 7 is the answer, because 2*3=6,6/5=1.2 and 1.2%7=7

Let me know the numbers belongs to which set natural,integer or Real.

  Was this answer useful?  Yes

Devanathan.J

  • Dec 21st, 2005
 

How u got 1 in the second step.

Can U explain me

  Was this answer useful?  Yes

Babzee

  • Jan 5th, 2006
 

Ravi, 5 % 7 =1 is wrong, since modulo operation gives the remainder.

So, i think 5%7=5.

Rest, the approach You have followed is correct. Let me give it once more.

step1-    2*3/5%7,since % gets the preference over * and /.

step2-   2*3/5

step3-   6/5=1.2

So, 1.2 is the answer

  Was this answer useful?  Yes

yukti

  • Jan 25th, 2006
 

hi

 

can u pls tell what is the correct answer..

is it 1.2 or 7..

  Was this answer useful?  Yes

Green_bean

  • Feb 8th, 2006
 

Correct answer is 1.2% here means mudulo oeration, so it has highest priority.And 5%7=5, not 1.so 2*3/5%7 will look like this 2*3/(5%7)=6/5.

  Was this answer useful?  Yes

Noor

  • Feb 10th, 2006
 

According to Precedence rules,

The operators are evaluated left to right

Operator        Description                                        Associativity

*  /  %Multiplication/division/modulusleft-to-right

Therefore,

2*3/5%7 is

1.2*3=6

2.6/5=1.2

3.1.2%7=1.2

  Was this answer useful?  Yes

VIKRAM MAJJARI

  • Feb 25th, 2006
 

The answer is 1.2explanation:Replace the operators as given in the question.2*3/5%7since all the operators have equal precedence the evaluation is from left to right.=6/5%7=1.2%7=1.2

  Was this answer useful?  Yes

santosh kumar singh

  • Apr 6th, 2006
 

Hi all.* , / , % have the same priority order and left to right associativity.So my answer is as follow:step1:2*3/5%7step2:6/5%7step3:1%7step4:1 Hence anser is:1

  Was this answer useful?  Yes

comment - % operator cannot be performed on floating point numbers also here the 3 operators present, all have left to right associativity .. so 2*3/5%7 is treated as  ((2*3)/5) %7

and    * or /  or % all have the same precedence so we have to consider associativity

  1) 2*3=6

  2) 6/5=1.2

  3) 1.2%7 in 'C' will give u an error ... " illegal use of floating point"

  Was this answer useful?  Yes

gunjan chaudhary

  • May 4th, 2006
 

 I Suppose u all are viewing or taking % operator in a wrong sense as a%b is remainder left after dividing a by b so when we do 5%7 it is equal to zero & then we have to divide by zero which is not possible so its ans does not exits

  Was this answer useful?  Yes

rakesh

  • Jun 8th, 2006
 

Try it on TC++
 
The answer is 1
 
printf("%d",2*3/5%7)
 

  Was this answer useful?  Yes

pranav

  • Jul 10th, 2006
 

The operator precedence for multiplicative operators is same..ie % / and * enjoy same priority...and left to right evaluation

according to c prog..or c++ prog..the ans is evaluated this
2*3=6
6/5=1 (its integer division friends...decimal truncated)
and 1%7 =1 as 7 goes 0 times in 1..thereby leaving remainder 1

  Was this answer useful?  Yes

lokeshbgh

  • Aug 4th, 2006
 

The answer is 1. When we have the same priority then we execute it from L to R. So 2*3=6,6/5=1,1%7=1 We cannot use module operator in floats that is why 6/5 became 1 and 1%7=1.

  Was this answer useful?  Yes

Milan Agarwal

  • Sep 8th, 2006
 

I agree to above, 1 is correct answer, B very clear that % operator works only for integers and secondly the precedence of /,%,* is same and evaluated on basis of whichever comes 1st from left to right

  Was this answer useful?  Yes

Navdeep

  • Sep 9th, 2006
 

Yes ravi is right, the ans. is 6, b a

  Was this answer useful?  Yes

sakshi

  • Oct 31st, 2006
 

2*(3/(5%7))

here % has higher precedence than / and after that *.

therefore 2*(3/5) { as 5%7=5}

=2*(0.6)

=1.2 (ans)

  Was this answer useful?  Yes

arti

  • Dec 20th, 2006
 

i think the ans is 0 coz ultimately all signs turn to %----->

2+3*5/7

=2*3/5%7

=2/3%5%7

=2%3%5%7

=0

wat do u guys think of this?im just thinkin this is the way..

  Was this answer useful?  Yes

murali

  • Jan 2nd, 2007
 

step : 2*3/5%7

= 2*3 = 6

= 6/5 = 1.2

= 1.2%7

= 0.084

  Was this answer useful?  Yes

Jak

  • Jan 8th, 2007
 

How about this?

2+3*5/7

= 2*3/5%7 (operators changed according to the given rules)

= 2/3%5%7 (operators changed according to the given rules)

= 2%3%5%7 (operators changed according to the given rules)

= ((2%3)%5)%7 

= (2%5)%7

= 2%7 = 2

Munish Jain

  • Feb 8th, 2007
 

Dear all
This is good answer.
Your concepts are clear.
Best of luck.
Bye

  Was this answer useful?  Yes

Question is-->2+3*5/7

now after replacing + by *, * by / , / by % question become like this


                 2*3/5%7


   solution is------>
    
       (2*3)/(5%7)
==>6/5                                (since % represents remainder so 5%7== 5)


==>1.2 answer

  Was this answer useful?  Yes

BASHA

  • Aug 20th, 2007
 

2*3/5%7
=(2*3)/5%7
=6/5%7
  (1.2)%7
=1.2

Precedence is * / %

  Was this answer useful?  Yes

c.praveen sagar

  • Aug 26th, 2007
 

2*3/5%7=6/5%7=6/5=1.2

  Was this answer useful?  Yes

Ashish_k

  • Dec 27th, 2009
 

After changing it new infix notation is 2*3/5%7 2*3/5 after solving mod(%)2*0.6 after (/) 1.2 is the answer.

  Was this answer useful?  Yes

If operator precedence is taken in C language then

2*3/5%7=1
from L to R PRECEDENCE
2*3=6
6/5=1 it give question in return
1%7=1 it gives remainder in return

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions