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
hi, which software companys will take,if d candidate's % is jst 55%?
How many levels of pointers have?
When should I declare a function?
What is else if ladder?
What is strcpy() function?
What Is The Difference Between Null And Void Pointer?
I heard that you have to include stdio.h before calling printf. Why?
what are enumerations in C
What is boolean in c?
What is chain pointer in c?
how do you write a function that takes a variable number of arguments? What is the prototype of printf () function?
Array is an lvalue or not?
Explain the difference between strcpy() and memcpy() function?
What is void c?
hai iam working in sap sd module for one year and working in lumax ind ltd in desp department but my problem is i have done m.b.a in hr/marketing and working sap sd there is any combination it. can you give right solution of my problem. and what can i do?