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 are shell structures used for?
Why isn't any of this standardized in c? Any real program has to do some of these things.
What does printf does?
i have to apply for the rbi for the post of officers. i need to know abt the entrance questions whether it may be aps or techinical....
How will you declare an array of three function pointers where each function receives two ints and returns a float?
How can I implement sets or arrays of bits?
A c program to display count values from 0 to 100 and flash each digit for a secong.reset the counter after it reaches 100.use for loop,. pls guys hepl me.. :(
What is const and volatile in c?
i have a written test for microland please give me test pattern
What is a void pointer in c?
p*=(++q)++*--p when p=q=1 while(q<=6)
Explain how can I make sure that my program is the only one accessing a file?
What are the salient features of c languages?
a program that can input number of records and can view it again the record
formula to convert 2500mmh2o into m3/hr