Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <string.h>
- #include <ctype.h>
- int isvowel(char ch);
- int main( ) {
- char str[81];
- int len, i, nvowel=0, nupper=0, nlower=0;
- printf("Enter your string >");
- gets(str);
- len=strlen(str);
- for (i=0; i<len; i++){
- if (isvowel(str[i]))
- nvowel++;
- }
- str[0]=toupper(str[0]);
- for (i=1; i<len; i++)
- str[i]=tolower(str[i]);
- printf("Number of vowels = %d\n", nvowel);
- printf("Capitalised string = %s\n", str);
- system("pause");
- return 0;
- }
- int isvowel(char ch){
- int vowel;
- char lower=tolower(ch);
- vowel=lower=='a'||lower=='i'||lower=='o'||lower=='u'||lower=='e';
- return vowel;
- }
Advertisement
Add Comment
Please, Sign In to add comment