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 is difference between arrays and pointers?
explain what is an endless loop?
What are the features of c languages?
What is a pointer value and address in c?
What does dm mean sexually?
How are portions of a program disabled in demo versions?
Explain what standard functions are available to manipulate strings?
What is c standard library?
What is the function of volatile in c language?
Explain low-order bytes.
Why is c known as a mother language?
Write a program to reverse a linked list in c.
What is getche() function?
Can we assign string to char pointer?
What is keyword with example?