to get a line of text and count the number of vowels in it
Answers were Sorted based on User's Feedback
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 |
#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 |
What is structure in c language?
write an interactive program to generate the divisors of a given integer.
What is the use of typedef in c?
why programming language C is still used in operating system's kernel??
Which function in C can be used to append a string to another string?
what is self refrential structure
How will you declare an array of three function pointers where each function receives two ints and returns a float?
What is pass by reference in c?
What is difference between structure and union in c?
Differentiate between a for loop and a while loop? What are it uses?
What are register variables in c?
How can I implement opaque (abstract) data types in C? What's the difference between these two declarations? struct x1 { ... }; typedef struct { ... } x2;