Winners
Likith 4th sem BCA
Nandhini D 4th Sem BCA
Program to print all vowels and consonant characters of a string separately
Note:Write a code in any programming language.
Solution should be submitted on or before 11/03/2020 with explanation
First 5 students who will submit the solution earlier will be considered as winners.
Name of the winners will be displayed on NOTICE board by next Wednesday.
Solution:
#include<stdio.h>#include<conio.h>
void main()
{
char text[100];
int i;
clrscr();
printf("Enter any string: ");
gets(text);
printf("String is: ");
for(i=0;text[i]!='\0';i++)
{
printf("%c",text[i]);
}
printf("\n");
printf("VOWEL Characters are: ");
for(i=0;text[i]!='\0';i++)
{
if(text[i]=='A' || text[i]=='a' || text[i]=='E' ||
text[i]=='e' || text[i]=='I' || text[i]=='i' || text[i]=='O' ||
text[i]=='o' || text[i]=='U' || text[i]=='u')
printf("%c",text[i]);
}
printf("\n");
printf("CONSONANT Characters are: ");
for(i=0;text[i]!='\0';i++)
{
if(!(text[i]=='A' || text[i]=='a' || text[i]=='E' ||
text[i]=='e' || text[i]=='I' || text[i]=='i' || text[i]=='O' ||
text[i]=='o' || text[i]=='U' || text[i]=='u'))
printf("%c",text[i]);
}
printf("\n");
getch();
}
Winners
No comments:
Post a Comment