C Language

June 5, 2023

How to use switch with break statement in C language

program to use switch with break statement in C language


#include<stdio.h>
int main()
{
    int choice;
    printf("Enter your choice : ");
    scanf("%d",&choice);
    switch (choice)
    {
    case 1:

        printf("first\n");
        break;
    case 2:
        printf("second\n");
        break;
    case 3:
        printf("third\n");
        break;
    default:
        printf("Wrong choice\n");
    }
    return 0;
}

output


Enter your choice : 2
second

by : Ajaj Khan

Quick Summary:

इस program मैं कोई सा भी case choice कर ने पर बस वही case print होगा क्यू की हर case मैं break लगा हैं