Wednesday, December 31, 2014

switch case

1:
#include<stdio.h>
///vowel_consonent
int main(){

     char vowel;
     scanf("%c",&vowel);

     switch(vowel){

        case 'a': printf("It is vowel");
        break;

        case 'e': printf("It is vowel");
        break;

        case 'i': printf("It is vowel");
        break;

        case 'o': printf("It is vowel");
        break;

        case 'u': printf("It is vowel");
        break;

        default:printf("It is consonent");
        break;

     }
return 0;
}

output: depend on your value

2:
#include <stdio.h>
///switch case:

int main()
{
int number;
scanf("%d",&number);
switch(number){
case 1:
    printf("The number is 1\n");
    break;
    case 2:
    printf("The number is 2\n");
    break;
    case 3:
    printf("The number is 3\n");
    break;
}
return 0;
}

output: depend on your value

No comments:

Post a Comment