to get a line of text and count the number of vowels in it

Answers were Sorted based on User's Feedback



to get a line of text and count the number of vowels in it..

Answer / chandra sekhar kommuri

#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':
case 'A':
case 'e':
case 'E':
case 'i':
case 'I':
case 'o':
case 'O':
case 'u':
case 'U':count++;
}
printf("\n Number of vowels:%d",count);
getch();
}

Is This Answer Correct ?    75 Yes 24 No

to get a line of text and count the number of vowels in it..

Answer / 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

to get a line of text and count the number of vowels in it..

Answer / sachin

Write a program to print the size of all the data types supported by C and its range?

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More C Interview Questions

What are the different pointer models in c?

4 Answers  


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

0 Answers  


write a program to sum of its digit with using control structure or with out using loop. for ex: let the number is 25634 then answer will be=2+5+6+3+4=20

4 Answers  


What are qualifiers and modifiers c?

0 Answers  


Who is invented by c?

24 Answers   Infosys, Mphasis,






Write a program to produce the following output: 1 2 3 4 5 6 7 8 9 10

8 Answers   Aspire,


write a program which the o/p should b in such a way that s triangle if I/p is 3,a Square/rectangle if I/P=4,a pentagon if I/P=5 and so on...forget about the I/P which is less than 3

0 Answers   ADP,


what is the difference between declaration and definition of a variable or function ?

3 Answers  


Just came across this question, felt worth sharing, so here it is I want you to make a C/C++ program that for any positive integer n will print all the positive integers from 1 up to it and then back again! Let's say n=5 I want the program to print: 1 2 3 4 5 4 3 2 1. Too easy you say? Okay then... You can ONLY USE: 1 for loop 1 printf/cout statement 2 integers( i and n) and as many operations you want. NO if statements, NO ternary operators, NO tables, NO pointers, NO functions!

1 Answers  


What is the use of define in c?

0 Answers  


Please list all the unary and binary operators in C.

3 Answers  


What is array in C

0 Answers  


Categories