C MAGICAL PROGRAM ME:-

Posted by Tushar Bedekar


void main()
{
int a;
a=300*300/300;
printf(“%d”,a);
}
What will be the output of the above Program

Few options which I can give are -

(1)300
(2)1
(3)81
(4)600
The Correct answer for this question is -

Option 3 i.e. 81

Confused???????

Check here



In C integer has range from -32768 to 32767.
Hence          32767 + 1 = -32768
Similarly       32767 + 3 = -32766

For the above question

300*300=90000

The value stored in integer variable ‘a’ is 24300

Now 24300/300 = 81 



Hence the answer is 81

0 comments:

Post a Comment

back to top