Answer Posted / 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 |
Post New Answer View All Answers
What does the function toupper() do?
How pointers are declared?
Why should I use standard library functions instead of writing my own?
What is preprocessor with example?
shorting algorithmS
Explain how do you determine a file’s attributes?
Explain what’s a signal? Explain what do I use signals for?
Synonymous with pointer array a) character array b) ragged array c) multiple array d) none
What is the difference between struct and union in C?
Explain do array subscripts always start with zero?
Explain how can you tell whether a program was compiled using c versus c++?
Why void main is used in c?
What is static memory allocation?
What is a node in c?
Why c is called a mid level programming language?