aliensbrain
  • Home
  • Topics
  • Quizzes
  • 🎤AI Practicefree
  • Notebooks
  • Community
  • Sign in
Multiple choice general knowledge

Guess the Output? void main() { int i=5; i+=i*=i-=i/i; printf("%dn",i); }

  1. 1

  2. 4

  3. 5

  4. 29

Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

The expression i+=i*=i-=i/i evaluates as: i/i = 1, i-=1 makes i=4, i*=4 makes i=16, i+=16 makes i=5 (using the original i=5 from the left side of += due to sequence point rules in C). This is a classic compound assignment trick question.

Keep practicing — related questions

  • What will be the output of the code snippet? int funct(a,b) int a,b; { return a*b; } void main() { int i=13...
  • What will be the output of the program? class Test { public static void main(String [] args) { int x= 0; in...
  • What will be the output of following C code? void main() { int t,*pt; register int y,*py; pt=&t; py=&y; t=1...
  • What will be the output of the following C code? int T; static T= 8; extern T; void main() { printf(%d,T); }
  • What will be the output of the following C code? void main() { int T='T'; printf(%c,T+6); }
  • What will be the output of the following C code? void main() { int t=70,c=14,d; d=t/**//c; printf(%d,d); }
  • What will be the output of the following C code? void main() { int fact=1,i; clrscr(); for(i=2;i<=8;i++) fa...
  • If the input of the following program is 10, what will be the output? void print(int); void main() { int n;...
Advertisement
© Aliensbrain | all rights reserved
  • About
  • Contact
  • Terms and Condition
  • Privacy Policy