Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

what are the advantage of pointer variables? write a program
to count the number of vowels and consonants in a given string

Answer Posted / gaurav kumar

#include <stdio.h>

int vowel;
int consonant;

void check_vowel(char c)
{
if ( c != 'a' && c != 'e' && c != 'i' && c != 'o' && c != 'u' && c != 'A' && c != 'E' && c != 'I' && c != 'O' && c != 'U')
consonant ++;
else
vowel++;
return;
}

int main(void) {
char p[25];
char *ptr=p;

printf("Enter a string:");
scanf(" %[^\n]25s",p);

printf("%s\n",p);
printf("%c\n",*p);

while(*ptr != '\0')
{
if(*ptr != ' ')
check_vowel(*ptr);
ptr++;
}
printf("The number of vowels : %d and consonants : %d in %s \n",vowel,consonant,p);

return 0;
}

Please mail me if any compact solution?

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is a struct c#?

1061


What are the keywords in c?

1130


What is the condition that is applied with ?: Operator?

1135


How do you declare a variable that will hold string values?

1184


Is register a keyword in c?

1052


Explain what is the difference between null and nul?

1168


Explain what is wrong with this program statement?

1127


The postoder traversal is 7,14,3,55,22,5,17 Then ur Inorder traversal is??? please help me on this

3585


What is meant by int main ()?

1214


What is the purpose of the preprocessor directive error?

1279


What is the basic structure of c?

1095


Can you write the algorithm for Queue?

2128


What are compound statements?

1188


a formula,a series of steps,or well defined set of rules for solving a problem a) algorithem b) program c) erdiagram d) compiler

1085


What is the use of function overloading in C?

1182