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 does sizeof int return?
What are header files? What are their uses?
What is modifier & how many types of modifiers available in c?
what does data structure mean?
What is the translation phases used in c language?
What is a shell structure examples?
What is the purpose of void pointer?
How many types of errors are there in c language? Explain
Is c is a procedural language?
WAP that prints the number from 1 to 100. but for multiplies of three print "XXX" instead of the number and for the multiplies of five print "YYY" . for number which are multiplies of both three and five print "ZZZ"
program to find the magic square
a simple program in c language