/* PROGRAM TO COUNT NUMBER OF VOWELS AND CONSONANTS FROM STRING*/ # include # include void main( ) { char str[20]; int i=0, cnt1=0, cnt2=0; printf("Enter a string:"); scanf("%s",str); while(str[i]!=NULL) { if (str[i]=='a' || str[i]=='e' || str[i]=='i' || str[i]=='o' || str[i]=='u') { cnt1++; // cnt1 count characters which are vowel. } else { cnt2++; // cnt2 counts when characters are not vowel } i++; } printf("\n Total number of Vowels=%d”, cnt1); printf("\n Total number of Consonants =%d”, cnt2 ); }
//counting vowels n conconents in string
ReplyDelete#include
#include
void main()
{
char str[10];
int i=0,cnt1=0,cnt2=0;
printf("Enter the string=");
gets(str);
while(str[i]!=NULL)
{
if(str[i]=='a'||str[i]=='e'||str[i]=='o'||str[i]=='u'||str[i]=='i')
{
cnt1++;
}
else
{
cnt2++;
}
i++;
}
printf("\ntotal vowels=%d total conconents=%d",cnt1,cnt2);
}
/*To count the total no.of vowel & consonant*/
ReplyDelete#include
#include
void main()
{
char str[10];
int i=0,cnt1=0,cnt2=0;
printf("\n\tEnter a string");
gets(str);
while(str[i]!=NULL)
{
if(str[i]=='a'|| str[i]=='e'|| str[i]=='i'|| str[i]=='o'|| str[i]=='u')
{
cnt1++;
}
else
{
cnt2++;
}
i++;
}
printf("Total no. of vowel=%d \n\t Total no. of consonant=%d",cnt1,cnt2);
}
/*To count the total no.of vowel & consonant*/
ReplyDelete#include
#include
void main()
{
char str[10];
int i=0,cnt1=0,cnt2=0;
printf("\n\tEnter a string");
gets(str);
while(str[i]!=NULL)
{
if(str[i]=='a'|| str[i]=='e'|| str[i]=='i'|| str[i]=='o'|| str[i]=='u')
{
cnt1++;
}
else
{
cnt2++;
}
i++;
}
printf("Total no. of vowel=%d \n\t Total no. of consonant=%d",cnt1,cnt2);
}
/*display vowel and consonant using string*/
ReplyDelete#include
#include
void main()
{
char str[10];
int i=0,cnt1=0,cnt2=0;
printf("\n\t enter a string");
gets(str);
while(str[i]!=NULL)
{
if(str[i]=='a'||str[i]=='e'||str[i]=='i'||str[i]=='o'||str[i]=='u')
{
cnt1++;
}
else
{
cnt2++;
}
i++;
}
printf("\n\t total vowel=%d \n\t total consonant=%d",cnt1,cnt2);
}
//counting no.of vowels & consonant from given string
ReplyDelete#include
#include
void main()
{
char s[10]={"krishna"};
int c1=0,c2=0,i=0;
while (s[i]!=NULL)
{
if (s[i]=='a'||s[i]=='e'||s[i]=='i'||s[i]=='o'||s[i]=='u')
{
c1++;
}
else
{
c2++;
}
i++;
}
printf("\n Total vowels=%d \t Total consonant=%d \n",c1,c2);
}
#include
ReplyDelete#include
void main()
{
char str[50];
int i=0,cnt1=0,cnt2=0;
printf("enter a string=");
gets(str);
while(str[i]!=NULL)
{
if(str[i]=='a'||str[i]=='e'||str[i]=='i'||str[i]=='o'||str[i]=='u')
{
cnt1++;
}
else
{
cnt2++;
}
i++;
}
printf("number of vowels=%d\nnumber of consonant=%d\n",cnt1,cnt2);
}
//counting vowels n consonants of string
ReplyDelete#include
#include
void main()
{
char s[10];
int cnt1=0,cnt2=0,i=0;
printf("\nenter ur string");
gets(s);
while(s[i]!=NULL)
{
if(s[i]=='a'||s[i]=='e'||s[i]=='i'||s[i]=='o'||s[i]=='u')
{
cnt1++;
}
else
{
cnt2++;
}
i++;
}
printf("\ntotal vowels=%d total consonant=%d",cnt1,cnt2);
}
/*count vowel & consonent*/
ReplyDelete#include
#include
#include
void main()
{
char str[8];
int cnt1=0,cnt2=0; int i;
printf("\n\t enter sting");
gets(str);
while(str[i]!=NULL)
{
if(i=='a'||i=='e'||i=='i'||i=='o'||i=='u')
{
cnt1++;
}
else
{
cnt2++;
}
i++;
}
printf("total vowel=%d,consonent=%d",cnt1,cnt2);
}
#include
ReplyDelete#include
void main()
{
char str[10];
int i=0, cnt1=0,cnt2=0;
printf("\n enter the string");
gets(str);
while(str[i]!=NULL)
{
if(str[i]=='a'||str[i]=='e'||str[i]=='i'||str[i]=='o'||str[i]=='u')
{
cnt1++;
}
else
{
cnt2++;
}
i++;
}
printf("\n total no of vowel=%d consonent=%d",cnt1,cnt2);
}
/* PROGRAM TO COUNT NUMBER OF VOWELS AND CONSONANTS FROM STRING*/
ReplyDelete# include
# include
void main( )
{
char str[20];
int i=0, cnt1=0, cnt2=0;
printf("Enter a string:");
scanf("%s",str);
while(str[i]!=NULL)
{ if (str[i]=='a' || str[i]=='e' || str[i]=='i' || str[i]=='o' || str[i]=='u')
{
cnt1++; // cnt1 count characters which are vowel.
}
else
{
cnt2++; // cnt2 counts when characters are not vowel
}
i++;
}
printf("\n Total number of Vowels=%d”, cnt1);
printf("\n Total number of Consonants =%d”, cnt2 );
}
/* count vowel & consonant of string */
ReplyDelete#include
#include
#include
void main()
{
char str[10];
int i=0;cnt1=0,cnt2=0;
printf("enter string");
gets(str);
while(str[i]!=NULL)
{
if(str[i]=='a'||str[i]=='e'||str[i]=='i'||str[i]=='o'||str[i]=='u')
{
cnt1++;
}
else
{
cnt2++;
}
printf("\n total vowel=%d total consonant=%d",cnt1,cnt2);
}
}
/*No of vowel n consonant*/
ReplyDelete#include
#include
void main()
{
char s[10];
int i=0,cnt1=0,cnt2=0;
printf("\n\t enter a string");
gets(s);
while(s[i]!=NULL)
{
if(s[i]=='a'||s[i]=='e'||s[i]=='i'||s[i]=='o'||s[i]=='u')
{
cnt1++;
}
else
{
cnt2++;
}
i++;
}
printf("\n\t total no of vowel=%d,total no of consonanat=%d",cnt1,cnt2);
}