 Coffee Room
Discuss anything here - everything that you wish to discuss with fellow engineers.
12775 Members
Join this group to post and comment. 'C' code

int g=300*300/300;
cout<<"g="<
what would be the value of g? If you think the answer is you got is correct Rocker • Nov 9, 2006
int g=300*300/300;
cout<<"g="<
what would be the value of g? If you think the answer is you got is correct
I'm not a C coder, but g = 109.223 😉

Right?

Justification, 300*300 exceeds max. integer range which is -32768 to 32767 amitpshukla • Nov 9, 2006

i want to design a low power radio circuit, please give some ideas. sahana • Nov 10, 2006
300*300/300

first 300*300 will be computed which is 90000.this is greater than 32767 which is the limit of data type int.hence 90000%32767 will be calculated which is 24466.now this will be divided with 300 (as the expression is 300*300/300). hence the answer is 81. crook • Nov 10, 2006
sahana
300*300/300

first 300*300 will be computed which is 90000.this is greater than 32767 which is the limit of data type int.hence 90000%32767 will be calculated which is 24466.now this will be divided with 300 (as the expression is 300*300/300). hence the answer is 81. Good one sahana and crook. Keep up the good work.
post in more puzzels rick • Nov 12, 2006
Good one sahana and crook. Keep up the good work.
post in more puzzels Yup 81 is the right answer. Plz do post some c or c++ puzzles Munguti • Oct 1, 2010  