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's the difference between a linked list and an array?
how to solve "unable to open stdio.h and conio.h header files in windows 7 by using Dos-box software
find the output? void r(int a[],int c, int n) { if(c>n) { a[c]=a[c]+c; r(a,++c,n); r(a,++c,n); } } int main() { int i,a[5]={0}; r(a,0,5); for(i=0;i<5;i++) printf("\n %d",a[i]); getch(); }
Is the below things valid & where it will be stored in memory layout ? static const volatile int i; register struct { } ; static register;
Explain the Difference between the New and Malloc keyword.
What is the function of multilevel pointer in c?
How can I read a binary data file properly?
Sir,please help me out with the output of this programme:- #include<stdio.h> #include<conio.h> void main() { int a=18,b=12,i; for(i=a<b?a:b;a%i||b%i;i--); printf("%d %d",i); }
increment operateor (++)and decrament(--) #include<stdio.h> #inclide<conio.h> main() { int x=15; while(x!=0) scanf("%d",&x); {
What is the output of following program ? int main() { int x = 5; printf("%d %d %d\n", x, x << 2, x >> 2); }
i want to know aptitude questions,technical questions
What is define c?