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 are examples of structures?
How can I pad a string to a known length?
Why isn't any of this standardized in c? Any real program has to do some of these things.
Write a C program to find the smallest of three integers, without using any of the comparision operators.
Why doesnt that code work?
Why n++ execute faster than n+1 ?
What does %d do?
i want explaination about the program and its stack reprasetaion fibbo(int n) { if(n==1 or n==0) return n; else return fibbo(n-1)+fibbo(n-2); } main() { fibbo(6); }
What does *p++ do? What does it point to?
What is structure padding & expalain wid example what is bit wise structure?
two progs are given. one starts counting frm 0 to MAX and the other stars frm MAX to 0. which one executes fast.
int i=0,j; j=++i + ++i ++i; printf(" %d",j);