← Share another text

Shared on Droptext

Untitled text

Posted on 2026-05-2199 views
#include <stdio.h> int main() { char str[200]; int v=0, c=0, d=0, s=0, sym=0, i; printf("Enter a string: "); fgets(str, 200, stdin); for(i=0; str[i]!='\0'; i++) { char ch = str[i]; if(ch=='a'||ch=='e'||ch=='i'||ch=='o'||ch=='u'|| ch=='A'||ch=='E'||ch=='I'||ch=='O'||ch=='U') v++; else if((ch>='a'&&ch<='z') || (ch>='A'&&ch<='Z')) c++; else if(ch>='0'&&ch<='9') d++; else if(ch==' ') s++; else if(ch!='\n') sym++; } printf("\nVowels : %d", v); printf("\nConsonants : %d", c); printf("\nWhite spaces : %d", s); printf("\nDigits : %d", d); printf("\nSymbols : %d", sym); return 0; }