Switch case (Resolve Error in Program) - C Language Programming



This program contains some error due to current output of this program is

 Two
 Three

Which is wrong. Correct output is

Two

So, find out the error.

Click here to open this program in Turbo C++

/*******************************************************
 Statement - Switch case (Resolve Error)
 Programmer - Vineet Choudhary
 Written For - http://developerinsider.co
 *******************************************************/

#include <stdio.h>
#include <conio.h>

void main()
{
    int x = 2;
    clrscr();
    
    switch(x) {
        case 2:
            printf("Two\n");
        case 3:
            printf("Three\n");
    }
    
    getch();
}

/*Correct Output
 ----------------
 Two
 */

You've successfully subscribed to Developer Insider
Great! Next, complete checkout for full access to Developer Insider
Welcome back! You've successfully signed in
Success! Your account is fully activated, you now have access to all content.