to get a line of text and count the number of vowels in it
Answer Posted / swe
#include<stdio.h>
#include<conio.h>
#include<string.h>
void main()
{
char st[100];
int i,count=0;
clrscr();
printf("Enter line of text:");
gets(st);
for(i=0;st[i]!='\0';i++)
{
switch(st[i])
{
case 'a':count++;
break;
case 'A':count++;
break;
case 'e':count++;
break;
case 'E':count++;
break;
case 'i':count++;
break;
case 'I':count++;
break;
case 'o':count++;
break;
case 'O':count++;
break;
case 'u':count++;
break;
case 'U':count++;
break;
}
}
printf("\n Number of vowels:%d",count);
getch();
}
| Is This Answer Correct ? | 32 Yes | 15 No |
Post New Answer View All Answers
What is #define?
Explain how can you check to see whether a symbol is defined?
What is the explanation for modular programming?
What is function prototype in c with example?
I heard that you have to include stdio.h before calling printf. Why?
Is sizeof a keyword in c?
What is #include conio h?
What is wrong with this program statement?
What is sizeof int in c?
How variables are declared in c?
How do you define a string?
What are the different types of errors?
What are the differences between Structures and Arrays?
Is it acceptable to declare/define a variable in a c header?
What is #line?