Can anybody tell me what is wrong in this code | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
20th Dec 2023, 4:45 PM
Viraj Yadav
Viraj Yadav - avatar
2 Answers
+ 1
else block should indent if(*pt=='A'||*pt=='E'||*pt=='I'||*pt=='O'||*pt=='U'||*pt=='a'||*pt=='e'||*pt=='i'||*pt=='o'||*pt=='u') ctrV++; else ctrC++; pt++;
20th Dec 2023, 5:03 PM
A͢J
A͢J - avatar
+ 1
also, ctrC, not ctrC-1 printf("Number of vowels :%d\n Number of consonants :%d\n",ctrV,ctrC); your code counts blank spaces and digits as consonants.It fails at, for example: t e st123
20th Dec 2023, 10:05 PM
Bob_Li
Bob_Li - avatar