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

Explain high-order and low-order bytes.

1059


Is c language still used?

950


What functions are used in dynamic memory allocation in c?

1035


What is new line escape sequence?

1285


How many levels deep can include files be nested?

1115


Explain what is the difference between functions abs() and fabs()?

1123


How can I get back to the interactive keyboard if stdin is redirected?

1148


In which header file is the null macro defined?

1318


What are the types of assignment statements?

1032


What is meant by type specifiers?

1092


What is file in c preprocessor?

1101


How will you find a duplicate number in a array without negating the nos ?

2103


any function have arguments one or more OR not . it is compulsary a) any function compulsary have one or more arguments b) any function did not have arguments. It is not compulsary c) it is optional it is not compulsary d) none of the above

1074


Explain how do you override a defined macro?

1033


WRITE A CODE IN C TO SEARCH A FILE FROM NOTEPAD FILE.

2413