0

How this output equal to 7

#include<stdio.h> #define sqrt(x) x*x int main(){ printf("%d",sqrt(3+1)) }

17th Aug 2020, 5:43 PM
Nipuna Bhanuka Hettiwatta
Nipuna Bhanuka Hettiwatta - avatar
2 ответов
+ 1
Hey!! You've given the value of x =(3+1), here (3+1) is not equal to 4, so... Value of x is (3+1) not be 4, so.. (3+1) * (3+1) = 7, becoz according to precedence table it is working on right to left, so the program should be execute (*) first, 3+1 * 3+1 = 3+3+1=7.. as simple is that..
17th Aug 2020, 7:59 PM
Rupali Haldiya
Rupali Haldiya - avatar
0
Thanks all, I got the answer
18th Aug 2020, 12:55 AM
Nipuna Bhanuka Hettiwatta
Nipuna Bhanuka Hettiwatta - avatar