/*program character is c or v*/
#include <stdio.h>
void main ()
{
char ch ;
clrscr () ;
printf ("/n Enter a character:") ;
scanf ("%c", & ch) ;
switch (ch)
{
case 'a';
printf ("/n vowel:") ;
break ;
case 'e';
printf ("/n vowel:") ;
break ;
case 'i';
printf ("/n vowel:") ;
break ;
case 'o';
printf ("/n vowel:") ;
break ;
case 'u';
printf ("/n vowel:") ;
break ;
default :
printf ("/n character is consonant:") ;
}
getch () ;
}
This is program to check input character from user is vowel or consonant . For check vowel or consonant we have switch statement . The syntax of switch statement is;
switch ( conditional variable )
{
case value 1 ;
statement ;
break ;
case value 2 ;
statement ;
break ;
"
"
"
default :
statement :
}
So using this we can write the program for using different conditional program .
#include <stdio.h>
void main ()
{
char ch ;
clrscr () ;
printf ("/n Enter a character:") ;
scanf ("%c", & ch) ;
switch (ch)
{
case 'a';
printf ("/n vowel:") ;
break ;
case 'e';
printf ("/n vowel:") ;
break ;
case 'i';
printf ("/n vowel:") ;
break ;
case 'o';
printf ("/n vowel:") ;
break ;
case 'u';
printf ("/n vowel:") ;
break ;
default :
printf ("/n character is consonant:") ;
}
getch () ;
}
This is program to check input character from user is vowel or consonant . For check vowel or consonant we have switch statement . The syntax of switch statement is;
switch ( conditional variable )
{
case value 1 ;
statement ;
break ;
case value 2 ;
statement ;
break ;
"
"
"
default :
statement :
}
So using this we can write the program for using different conditional program .
No comments:
Post a Comment