Example
#include<stdio.h>
#include<conio.h>
void main()
{
int a;
char c;
clrscr();
printf("Enter the char u want:");
scanf("%c",&c);
if(c=='a'|| c=='e' || c=='i' || c=='o' || c=='u')
{
a=1;
}
else if(c=='1'|| c=='2' || c=='3' || c=='4' || c=='4')
{
a=2;
}
else
{
a=3;
}
switch(a)
{
case 1:
printf("Character is vowels");
break;
case 2:
printf("\nCharacter is constant");
break;
case 3:
printf("\nCharacter is charater");
break;
default:
printf("Enter the character");
}
getch();
}
/*=========================================================================
OUTPUT
Enter the char u want:4
Character is constant */
#include<stdio.h>
#include<conio.h>
void main()
{
int a;
char c;
clrscr();
printf("Enter the char u want:");
scanf("%c",&c);
if(c=='a'|| c=='e' || c=='i' || c=='o' || c=='u')
{
a=1;
}
else if(c=='1'|| c=='2' || c=='3' || c=='4' || c=='4')
{
a=2;
}
else
{
a=3;
}
switch(a)
{
case 1:
printf("Character is vowels");
break;
case 2:
printf("\nCharacter is constant");
break;
case 3:
printf("\nCharacter is charater");
break;
default:
printf("Enter the character");
}
getch();
}
/*=========================================================================
OUTPUT
Enter the char u want:4
Character is constant */
No comments:
Post a Comment