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 the importance of c in your views?
What is the purpose of type declarations?
What are the different types of control structures?
Differentiate between Macro and ordinary definition.
How can I manipulate individual bits?
What are the basic data types associated with c?
What are the disadvantages of a shell structure?
Is void a keyword in c?
What is sizeof c?
Explain the difference between malloc() and calloc() function?
Can you assign a different address to an array tag?
What is the difference between array and linked list in c?
Why is c so popular?
What does c in a circle mean?
How do you initialize pointer variables?