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
 */

Join

Search articles

Search titles, tags and article content.

    You've successfully subscribed to Developer Insider
    Your account is ready. Welcome to Developer Insider
    Welcome back! You've successfully signed in
    Success! Your account is fully activated, you now have access to all content.