#define d 10+10
main()
{
printf("%d",d*d);
}

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


Please Help Members By Posting Answers For Below Questions

What does void main () mean?

722


What is c preprocessor mean?

777


How can I trap or ignore keyboard interrupts like control-c?

609


swap 2 numbers without using third variable?

656


When is the “void” keyword used in a function?

826






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

618


disply the following menu 1.Disply 2.Copy 3.Append; as per the menu do the file operations 4.Exit

1621


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

673


Which is better malloc or calloc?

645


Can variables be declared anywhere in c?

612


Explain how can I make sure that my program is the only one accessing a file?

614


How do I read the arrow keys? What about function keys?

606


define string ?

660


what is different between auto and local static? why should we use local static?

634


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?

653