Hello, OnlineGDB Q&A section lets you put your programming query to fellow community users. Asking a solution for whole assignment is strictly not allowed. You may ask for help where you are stuck. Try to add as much information as possible so that fellow users can know about your problem statement easily.

Write a program that input a string from the user and counts the number of vowels in the string

+1 vote
asked Jul 26, 2019 by anonymous

2 Answers

0 votes
answered Jul 29, 2019 by Rashmi Joshi (140 points)
#include <stdio.h>
#include<string.h>

int main()
{
    char str[100];
    int i,count=0,len;
    printf("enter string");
    gets(str);
    len=strlen(str);
    for(i=0;i<len;i++)
    {
        if(str[i]=='a' || str[i]=='e' || str[i]=='i' || str[i]=='o' || str[i]=='u' || str[i]=='A' || str[i]=='I' || str[i]=='E' || str[i]=='O' || str[i]=='U')
            count++;
        
    }
    printf("\nno of vowels : %d",count);

    return 0;
}
0 votes
answered Jul 31, 2019 by keerthanav666 (300 points)
#include<stdio.h>
int main()
{
    int i,j,c=0,k;
    char a[100];
    scanf("%[^\n]",a);
    for(i=0;a[i];i++);
    for(j=0;j<i;j++)
    {
       if(a[j]=='a'||a[j]=='e'||a[j]=='i'||a[j]=='o'||a[j]=='u')
        c++;
    }
    printf("%d",c);
    return 0;
}
Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and and receive answers from other members of the community.
...