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 |
who is the father of C Language?
20 Answers CTS, UST,
When the macros gets expanded?
Once I have used freopen, how can I get the original stdout (or stdin) back?
What is c token?
What is NULL pointer?
Hai why 'c' is the middle language
Define C in your own Language.
#include<stdio.h> int main( ) { Int a=300, b, c; if(a>=400) b=300; c=200; printf(“%d%d ”, b, c); return0; }
What will be the outcome of the following conditional statement if the value of variable s is 10?
compare array with pointer?
Explain how can I open a file so that other programs can update it at the same time?
What is variable initialization and why is it important?