Follow Our FB Page << CircleMedia.in >> for Daily Laughter. We Post Funny, Viral, Comedy Videos, Memes, Vines...


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 / anil kumar nahak

void main()
{
char *st;
int i=0,c=0;
printf("\n Enter A String:");
gets(st);
while(st[i]!='\0')
{
if(st[i]=='a' || st[i]=='A' || st[i]=='e' || st[i]=='E'
st[i]=='i' || st[i]=='I' || st[i]=='o' st[i]=='O' st[i]=='u'
|| st[i]=='U')
c++;
i++;
}

printf("\n the Number Of Vowels Present In The String Is :
%d",c);

}

Is This Answer Correct ?    3 Yes 1 No

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

Answer / vadivel t

#include<stdio.h>
#include<conio.h>

int main()
{
char ptr[100]= "She lives in NEWYORK";
printf("VOWELS EXIST %d TIME(S)\n",CountVow(ptr));
getch();
}

int CountVow(char *ptr)
{
int count = 0;
while(*ptr != '\0')
{
if((*ptr == 'a') || (*ptr == 'A') || (*ptr == 'e') ||
(*ptr == 'E') || (*ptr == 'i') ||
(*ptr == 'I') || (*ptr == 'o') || (*ptr == 'O') ||
(*ptr == 'u') || (*ptr == 'U'))
{
count++;
}
ptr++;
}
return count;
}

Is This Answer Correct ?    2 Yes 3 No

Post New Answer

More C Interview Questions

Write a program to compare two strings without using the strcmp() function

42 Answers   Accenture, Arba Minch University,


What is #ifdef ? What is its application?

0 Answers   TCS,


What is the difference between class and object in c?

0 Answers  


Magic square

0 Answers  


Can 'this' pointer by used in the constructor?

0 Answers  






what will be the output of this program? #include<stdio.h> #define cube(x) x*x*x void main() { int i,j=5; i=cube(j+3); printf("i=%d",i); }

6 Answers   IBM,


write a program to display the numbers in the following 4 4 3 3 2 2 1 1 0 1 1 2 2 3 3 4 4

1 Answers  


Can main () be called recursively?

0 Answers  


what is the return value (status code) of exit() function.... what the arguments(integer value) passed to it means....

1 Answers   TCS,


Differentiate between a for loop and a while loop? What are it uses?

0 Answers   TISL,


what is the different between data structure and data type?

1 Answers   Ignou,


pgm to find number of words starting with capital letters in a file(additional memory usage not allowed)(if a word starting with capital also next letter in word is capital cann't be counted twice)

0 Answers   Subex,






Categories