Searching...
Monday, November 4, 2013

Simple program of switch statement

4:09 AM


#include<stdio.h>
int main()
{
    int a;
    printf("Enter number (1-4):");
    scanf("%d",&a);
    switch(a){
    case 1:
    printf("you entered 1\n");
    break;
    case 2:
    printf("you have entered 2\n");
    break;
    case 3:
    printf("you have entered 3\n");
    break;
    case 4:
    printf("you have entered 4\n");
    break;

    defult:
    printf("\nInvalid");
    }
    return 0;
}

0 comments:

Post a Comment

Followers