#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 |
Is c compiled or interpreted?
What are volatile variables in c?
Define function ?Explain about arguments?
2 Answers Geometric Software, Infosys,
What is the use of linkage in c language?
Hi Every one......... Please Any body give me the answer for my question. Is it possible to print the word "PRINT F", without using printf() statement in C-Language.
Should I use symbolic names like true and false for boolean constants, or plain 1 and 0?
Define and explain about ! Operator?
What is wrong with this code such that it doesnt produce the input reversed? #include <stdio.h> #include <stdlib.h> #include <string.h> int main(void) { char Space = ' '; char LineOfText; float count; LineOfText = getchar(); while ((LineOfText = getchar()) != '/n'); { count = strlen(LineOfText) - 1; while (count >= 0) { putchar(LineOfText[count]); count--; } } getchar(); return 0; }
Why do we need a structure?
What is an array in c?
How old is c programming language?
Write a C program to accept a matrix of any size. Find the frequency count of each element in the matrix and positions in which they appear in the matrix