Wednesday, October 31, 2018

STRING: PROGRAM TO COUNT THE NUMBER VOWELS AND CONSONANT IN A STRING

#include<stdio.h>
void main()
{
char str[30];
int i,cv=0,c=0;
printf("Enter the string:");
gets(str);
for(i=0;str[i]!='\0';i++)
{
if(str[i]=='a'||str[i]=='A'||str[i]=='e'||str[i]=='E'||str[i]=='i'||str[i]=='I'||str[i]=='o'||str[i]=='O'||str[i]=='u'||str[i]=='U')
{
cv++;
}
else
{
c++;
}
}
printf("number of vowel in a string : %d",cv);
printf("\nnumber of consonant in a string : %d",c);
}

No comments:

Post a Comment

Static Member Function

CODE : #include<iostream> using namespace std; class test  {     int code;       static int count;               //static...