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 void main () mean?
What is c preprocessor mean?
How can I trap or ignore keyboard interrupts like control-c?
swap 2 numbers without using third variable?
When is the “void” keyword used in a function?
A collection of data with a given structure for excepting storing and providing on demand data for multiple users a) linked list b) datastructer c) database d) preprocessor
disply the following menu 1.Disply 2.Copy 3.Append; as per the menu do the file operations 4.Exit
count = 0; for (i = 1;i < = 10; i++);count = count + i; Value of count after execution of the above statements will be a) 0 b) 11 c) 55 d) array
Which is better malloc or calloc?
Can variables be declared anywhere in c?
Explain how can I make sure that my program is the only one accessing a file?
How do I read the arrow keys? What about function keys?
define string ?
what is different between auto and local static? why should we use local static?
The % symbol has a special use in a printf statement. Explain how would you place this character as part of the output on the screen?