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


Please Help Members By Posting Answers For Below Questions

Explain how do you determine whether to use a stream function or a low-level function?

632


What is const keyword in c?

755


How do you print an address?

752


What is advantage of pointer in c?

705


What does c in a circle mean?

587






Once I have used freopen, how can I get the original stdout (or stdin) back?

631


What is array of structure in c programming?

759


What is the use of pragma in embedded c?

597


How does sizeof know array size?

636


What are # preprocessor operator in c?

638


Iam a B.Tech graduate and completed my engineering in 2009, from 2005 to 2009 and after that i had done nothing.Now i want to do job and get into BPO field . Friends give me suggestions as what to say in interview... if they ask me that what would you had done ... these many years without doing job ??????? pls urgent

1432


What is the size of enum in bytes?

596


which of the following shows the correct hierarchy of arithmetic operations in C a) (), **, * or/,+ or - b) (),**,*,/,+,- c) (),**,/,*,+,- d) (),/ or *,- or +

1192


What is the difference between the expression “++a” and “a++”?

654


What is a structure and why it is used?

626