Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- int main () {
- int nv,nc,nw,ns,nchar,i;
- nv=nc=nw=ns=nchar=0;
- char c[50];
- puts("Enter any String");
- gets(c);
- for(i=0;c[i]!='\0';i++){
- if( c[i]=='a'||
- c[i]=='e'||
- c[i]=='i'||
- c[i]=='o'||
- c[i]=='u'||
- c[i]=='A'||
- c[i]=='E'||
- c[i]=='I'||
- c[i]=='O'||
- c[i]=='U'
- )
- {
- nv++;
- }
- else if (c[i]==' '){
- ns++;
- }
- else if (c[i]>=65 && c[i]<=90 ||
- c[i]>=97 && c[i]<=122
- ){
- nc++;
- }
- nchar = nv+nc;
- nw = ns+1;
- }
- if (strlen(c)>50){
- system("cls");
- puts("String was Too Large Only 50 Charecters Allowed");
- }
- else {
- system("cls");
- printf("\nNo. of Words = %d\nNo. of Vowels = %d\nNo. of Consonant = %d\nNo. of Space(s) = %d", nw,nv,nc,ns);
- printf("\nNo. of Charecters = %d (No Space Count)", nchar);
- }
- getch();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement