Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


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

Answers were Sorted based on User's Feedback



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

Answer / raj

ans.

d*d will be replaced by 10+10*10+10

during runtime.

so answer is 10+100+10 = 120

Is This Answer Correct ?    89 Yes 0 No

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

Answer / hussain reddy

120

Is This Answer Correct ?    8 Yes 2 No

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

Answer / vrushali

This boils down to (10 +10 * 10 + 10)

so answer is 120 ... but if the same macro was rewritten as
#define d (10 + 10)

then d * d = (10 + 10 ) * (10 + 10)
= 20 * 20
= 400....

Pure macro concept....

Is This Answer Correct ?    15 Yes 13 No

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

Answer / 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

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

Answer / mangal bhaldare

the value of d is 10+10
so the result is
(10+10)*(10+10)
=120

Is This Answer Correct ?    4 Yes 4 No

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

Answer / kumaran

400

Is This Answer Correct ?    3 Yes 46 No

Post New Answer

More C Interview Questions

why use "return" statement a) on executing the return statement it immediately transfers the control back to the calling program b) it returns the value present in the parentheses return, to the calling program c) a & b d) none of the above

0 Answers  


what is the differance between pass by reference and pass by value.

7 Answers   Infosys,


Why is conio.h not required when we save a file as .c and use clrscr() or getch() ?

2 Answers  


Average of a couple 10 years ago was 25. The average remains same after having a child and twins after 3 years. What is the present age of the first child

10 Answers   IBM, Infosys,


What is wrong with this statement? Myname = 'robin';

0 Answers  


Define function ?Explain about arguments?

2 Answers   Geometric Software, Infosys,


What is the difference between the = symbol and == symbol?

0 Answers  


Define recursion in c.

0 Answers  


#include<std.h> int main() { char *str[]={"Frogs","Do","Not","Die","They","Croak!"}; printf("%d %d\n",sizeof(str),strlen(str)); ...return 0; } what will the output of the above program?

6 Answers  


how to write a data 10 in address location 0x2000

3 Answers  


write a c program to print "Welcome" without using semicolon in the whole program ??

15 Answers   Infosys, TCS,


How can I find leaf node with smallest level in a binary tree?

1 Answers  


Categories