0% found this document useful (0 votes)
4 views1 page

C Quest

The document contains a C program that counts various elements in a string input. It tracks the number of vowels, consonants, lines, and characters, excluding spaces and newlines. The program outputs the totals for each category after processing the input string.

Uploaded by

jipaxi1217
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views1 page

C Quest

The document contains a C program that counts various elements in a string input. It tracks the number of vowels, consonants, lines, and characters, excluding spaces and newlines. The program outputs the totals for each category after processing the input string.

Uploaded by

jipaxi1217
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

#include <stdio.

h>
int main()
{
char str[100];
int vo=0,con=0,newline=0,characters=0,alpha=0;
scanf("%[^~]",&str);
for(int i=0;str[i]!='\0';i++)
{
if(str[i] == '\n')
newline++;
else if(str[i] != ' ' && str[i] != '\n'){
characters++;
}
if(str[i]>=65 && str[i]<=90 || str[i]>=97 && str[i]<=122){
alpha++;
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')
vo++;
else
con++;
}

}
if(characters > 0)
newline++;
printf("Total number of alphabets : %d\n",alpha);
printf("Total number vowels is : %d and consonant is :%d\n",vo,con);
printf("Total number of lines : %d\n",newline);
printf("Total number of characters : %d\n",characters);
return 0;
}

You might also like