Multiple choice

What will be the output of the following C code? void main() { int fact=1,i; clrscr(); for(i=2;i<=8;i++) fact=fact*i; printf(%d,fact); }

    • 25215
    • 25216
    • 25217
    • 25218
Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

Factorial of 8 is out of range from the int data type (-32768 to +32767). Factorial of 8 is 40320, i.e. it goes to other end and displays the (40320 - 32767) = 7553th term from the -ve side. Hence, the output will be - 25216.