Computer Science, asked by nalinimaha82, 2 months ago

Write a C++ program for the following

1. Program to find number of vowels in a string.​

Answers

Answered by swarajhegde14
0

Answer:

#include <iostream>

#include <string.h>

int main()

{

char str[100];

int i,vowels=0;

cout<<"Enter the string : ";

gets(str);

for(i=0;str[i];i++)

{

if(str[i]=='a'|| str[i]=='e'||str[i]=='i'||str[i]=='o'||str[i]=='u'||str[i]=='A'||str[i]=='E'||str[i]=='I'||str[i]=='O' ||str[i]=='U')

{

vowels++;

}

}

cout<<"Total number of vowels in the string = "<<vowels;

return 0;

}

Similar questions