#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 |
what is the difference between getch() and getche()?
Explain the array representation of a binary tree in C.
Meaning of () in c
Explain how can you determine the size of an allocated portion of memory?
WAP to convert text into its ASCII Code and also write a function to decode the text given?
Explain how do you list files in a directory?
inline function is there in c language?
how to create duplicate link list using C???
i want to have a program to read a string and print the frequency of each character and it should work in turbo c
What is character set?
Write a program to write a given string in maximum possibilities? i.e str[5]="reddy"; i.e we can write this string in 120 ways for that write a program
Explain can the sizeof operator be used to tell the size of an array passed to a function?