#define d 10+10
main()
{
printf("%d",d*d);
}
Answers were Sorted based on User's Feedback
Answer / raj
ans.
d*d will be replaced by 10+10*10+10
during runtime.
so answer is 10+100+10 = 120
Is This Answer Correct ? | 88 Yes | 0 No |
Answer / vrushali
This boils down to (10 +10 * 10 + 10)
so answer is 120 ... but if the same macro was rewritten as
#define d (10 + 10)
then d * d = (10 + 10 ) * (10 + 10)
= 20 * 20
= 400....
Pure macro concept....
Is This Answer Correct ? | 15 Yes | 12 No |
Answer / jyothikrishna
Ex:1
#define A 10+10
void main()
{
int a;
a = A*A;
cout<<a<<endl;
}
Ans : 120
Explanation:
When you compile this program. A*A will be converted into 10+10*10+10. Here it follows BODMAS rule first it will perform multiplication and next it will perform addition.
First 10+10*10+10 = 10 + 100 + 10
next 10 + 100 + 10 = 120 (Answer)
Ex:2
#define A (10+10)
void main()
{
int a;
a = A*A;
cout<<a<<endl;
}
Ans : 400
Explanation:
When you compile this program. A*A will be converted into (10+10)*(10+10). Here it follows BODMAS rule first it will perform Bracket values and next it will perform multiplication.
First (10+10)*(10+10) = 20 * 20
next 20 * 20 = 400 (Answer)
Is This Answer Correct ? | 2 Yes | 1 No |
Answer / mangal bhaldare
the value of d is 10+10
so the result is
(10+10)*(10+10)
=120
Is This Answer Correct ? | 4 Yes | 4 No |
There is a mobile keypad with numbers 0-9 and alphabets on it. take input of 7 keys and then form a word from the alphabets present on those keys.
When should the volatile modifier be used?
When should volatile modifier be used?
Write a program to print factorial of given number without using recursion?
how to swap four numbers without using fifth variable?
Why isn't it being handled properly?
i want to switch my career from quailty assurance engineering to development kindly guide me from which programming language its better for me to start plz refer some courses or certifications too i have an experience of 1.5 yrs in QA field.Kindly guide me
Explain 'far' and 'near' pointers in c.
Are bit fields portable?
Explain what are global variables and explain how do you declare them?
What is volatile keyword in c?
What is #include called?