Home Basic Loop Array string Function Pointer Contact STUDY

AHF    C    PROGRAM    SOLVING

Programming tips

Specifer



" ; " after loop



Iterative statement



Working with switch case



Header file




String_ count vowel and consonant




// AHF C PROGRAM SOLVING

//solving here 2_D   ARRAY 	programming problem

#include #define pf printf int main() { int i,count=0,c=0,p=0,cons; char str[100],ch; pf("Enter the string: "); gets(str); for(i=0;str[i]!='\0';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') count++; //counting vowel } if(str[i]==' ') { c++; //counting space } if(ispunct(str[i])>0) { p++; //counting punctuation number } } //deleting vowel, space and punctuation character cons=i-(c+count+p); pf("\nThe total vowel in the string= %d",count); pf("\nThe total consonant in the string= %d",cons); return 0; }
OUTPUT:


© 2018 - All rights reserved