0

Though i put same value in both case sqr(4),sqr(3+1) it prints different values why?

https://code.sololearn.com/cC2ozqA4Oacj/?ref=app

11th Oct 2019, 9:18 AM
JoŃ•ĐœÏ…Î±
JoŃ•ĐœÏ…Î± - avatar
2 RĂ©ponses
+ 3
If you enter two numbers like sqr(a+b) it is giving output according to formula 2*a+b. If you want to get sqr(4) and sqr(3+1)'s out as their original squares then you should use sqr((3+1)) . In this it first does the part in bracket so one one input is given to sqr() function.
11th Oct 2019, 9:44 AM
Puthur Harthik
+ 1
Define acts like copy and paste. sqrt(4) = 4*4 = 16 sqrt(3+1) = 3+1*3+1 = 3 + 3 + 1 = 7 To make sqrt(4)==sqrt(3+1) true, the definition should be (x)*(x) (with brackets)
11th Oct 2019, 9:43 AM
äœ çŸ„é“èŠć‰‡ïŒŒæˆ‘äčŸæ˜Ż
äœ çŸ„é“èŠć‰‡ïŒŒæˆ‘äčŸæ˜Ż - avatar