#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

How to write a code for implementing my own printf() and scanf().... Please hep me in this... I need a guidance... Can you give an coding for c... Please also explain about the header files used other than #include...

4910


What is difference between structure and union in c programming?

577


How old is c programming language?

591


What is Dynamic memory allocation in C? Name the dynamic allocation functions.

566


What are pointers really good for, anyway?

623






Is there sort function in c?

583


What is a substring in c?

595


Explain how can you determine the size of an allocated portion of memory?

631


What are the different types of pointers used in c language?

618


What is the difference between printf and scanf in c?

757


How is a macro different from a function?

661


hello freinds next week my interview in reliance,nybody has an idea about it intervew questions..so tell

1677


struct screen_pos{ int row, col } ;move_right(cursor)struct screen_pos *cursor;{ cursor.col++; } /* This statementhas a syntax error */What is the correct statement a) cursor.col = cursor.col + 1; b) col.cursor++; c) *cursor.col++; d) pointer

772


What does 1f stand for?

618


How can you tell whether two strings are the same?

837