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
Explain how can you avoid including a header more than once?
Can we change the value of constant variable in c?
What is getch?
Explain void pointer?
What is the purpose of the statement: strcat (S2, S1)?
in ‘C’ language for Matrix Multiplication fails” Introspect the causes for its failure and write down the possible reasons for its failure.
What is the modulus operator?
Explain setjmp()?
program for reversing a selected line word by word when multiple lines are given without using strrev
GIven a sequence of characters. How will you convert the lower case characters to upper case characters. ( Try using bit vector - sol given in the C lib -> typec.h)
Is printf a keyword?
What is the difference between a free-standing and a hosted environment?
If fflush wont work, what can I use to flush input?
What are c preprocessors?
What is indirection? How many levels of pointers can you have?