#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 ? | 89 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 | 13 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 |
why use "return" statement a) on executing the return statement it immediately transfers the control back to the calling program b) it returns the value present in the parentheses return, to the calling program c) a & b d) none of the above
what is the differance between pass by reference and pass by value.
Why is conio.h not required when we save a file as .c and use clrscr() or getch() ?
Average of a couple 10 years ago was 25. The average remains same after having a child and twins after 3 years. What is the present age of the first child
What is wrong with this statement? Myname = 'robin';
Define function ?Explain about arguments?
2 Answers Geometric Software, Infosys,
What is the difference between the = symbol and == symbol?
Define recursion in c.
#include<std.h> int main() { char *str[]={"Frogs","Do","Not","Die","They","Croak!"}; printf("%d %d\n",sizeof(str),strlen(str)); ...return 0; } what will the output of the above program?
how to write a data 10 in address location 0x2000
write a c program to print "Welcome" without using semicolon in the whole program ??
How can I find leaf node with smallest level in a binary tree?