0

Why is the inserted code giving output as 64 but when i give cout<< pro(4); it gives 16 as output?

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

14th Feb 2020, 4:05 PM
Shatanik Mahanty
Shatanik Mahanty - avatar
6 Answers
+ 4
pro(n) -> n*n So pro(4) -> 4*4 And 64/pro(4) -> 64/4*4
14th Feb 2020, 4:09 PM
HonFu
HonFu - avatar
+ 3
HonFu Thanks for the help. I understood where i was making the mistake
14th Feb 2020, 4:15 PM
Shatanik Mahanty
Shatanik Mahanty - avatar
+ 3
It's just search&replace. It is our logic, that messes things up in this case. ;)
14th Feb 2020, 4:17 PM
HonFu
HonFu - avatar
+ 1
Just put n*n betwin prentheses # define pro(n) (n*n)
14th Feb 2020, 9:30 PM
Rafik Abdelhak Nadir
Rafik Abdelhak Nadir - avatar
+ 1
Rafik Abdelhak Nadir Thanks. It worked.👍👍
15th Feb 2020, 2:17 AM
Shatanik Mahanty
Shatanik Mahanty - avatar
+ 1
Shatanik Mahanty U r welcome.
15th Feb 2020, 4:44 AM
Rafik Abdelhak Nadir
Rafik Abdelhak Nadir - avatar