View the step-by-step solution to:


i dont understand as to why the following prints default twice and and does not print case 3: (this is in


#include <stdio.h>

int main ()


int a=1;

while (a <13)


switch (a)


  case 1:

    printf (" case 1n");


    break ;

  case 2:

    printf (" case 2n");


    break ;

  case 3:

    printf (" case 3n");


    break ;

  default :

    printf (" defaultn");




return 0;


Top Answer

#include &lt;stdio.h&gt; int main () { int a= 1 ; while (a &lt; 13 ) { switch (a) { case 1 : ... View the full answer

Sign up to view the full answer

Why Join Course Hero?

Course Hero has all the homework and study help you need to succeed! We’ve got course-specific notes, study guides, and practice tests along with expert tutors.

  • -

    Study Documents

    Find the best study resources around, tagged to your specific courses. Share your own to gain free Course Hero access.

    Browse Documents
  • -

    Question & Answers

    Get one-on-one homework help from our expert tutors—available online 24/7. Ask your own questions or browse existing Q&A threads. Satisfaction guaranteed!

    Ask a Question