+ 2
Why the output is 65 explain please.
#include <stdio.h> #define x 10+5 int main(){ int a=x*x; printf("%d",a); return 0; } //output is 65.
4 Answers
+ 7
10+5*10+5
As per basic math rule, first multiplication will happen then addition
10+50+5 = 65
+ 4
Let's break the code
#define is used to declare any variable with constant values which can not be changed through out the code.
Now a = x*x is 10+5*10+5
As Rishi Anand said according to basic math rules(division, multiplication, addiction, subtraction).
So 10+5*10+5 -> 10+50+5 -> 65.
0
follow basic math rule,
division, multiplication, addition, subtraction.
10+5*10+5=65.
đđđ
0
All the guys before explained the science behind your problem, I'd just add it is considered good practice for your definitions to be clear stated and usually comprised of a single sign avoiding operations and multiple objectsđđ