C Language

June 5, 2023

How to use switch control statement in C language

program to use switch control ststement in C language


#include <stdio.h>
int main()
{
    int choice;
    printf("Enter your choice : ");
    scanf("%d", &choice);
    switch (choice)
    {
    case 1:
        printf("first\n");
    case 2:
        printf("second\n");
    case 3:
        printf("third\n");
    default:
        printf("Wrong choice\n");
    }
    return 0;
}

output


Enter your choice : 1
first
second
third
Wrong choice

Tags:

by : Ajaj Khan

Quick Summary:

इस program मैं जो choice case 1 : करे गए तो case 1 : और case 2 : और case 3 : और wrong choice भी print होगा