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 getch () for?
Why can’t constant values be used to define an array’s initial size?
What are dangling pointers in c?
Explain the use of bit fieild.
Write a program to implement queue.
What standard functions are available to manipulate strings?
If I have a char * variable pointing to the name of a function ..
Why string is used in c?
A collection of data with a given structure for excepting storing and providing on demand data for multiple users a) linked list b) datastructer c) database d) preprocessor
What is #include called?
Why is c not oop?
Describe static function with its usage?
What is structure in c explain with example?
What are the difference between a free-standing and a hosted environment?
How can I copy just a portion of a string?