TCS
Company
Find the minimum value of abs(187m -396n + 526) where m and n are integers, if x > 0 abs(x)=x and if x < 0 then abs(x)= -x
Read Solution (Total 4)
-
- So to move closer to zero, 187m -396n should be closer or equal to -526
When m=1 and n=2, the value is ABS(-605+526) = 79.
when m=2 and n=3, the value is ABS(-627+526) = 101
when m=6 and n=4, the value is ABS(1122-1584+526) = 64
when m=8 and n=5, the value is ABS(1496-1980+526) = 42
when m=10 and n=6, the value is ABS(1870-2376+526) = 20
when m=12 and n=7, the value is ABS(2244-2772+526) = 2
when m=14 and n=8, the value is ABS(2618-3168+526) = 24
thus answer is 2 - 11 years agoHelpfull: Yes(19) No(0)
- @debolina how did u choose the values of m & n I mean according to which rule???
- 11 years agoHelpfull: Yes(11) No(0)
- m=-1,n=1
abs(-187-396+526)=abs(-57)
min =57
- 11 years agoHelpfull: Yes(6) No(3)
- how can u randomly choose m and n values
- 11 years agoHelpfull: Yes(0) No(0)
TCS Other Question