GoogelAddUnit1

Thursday 10 March 2011

C Program to counting of no of vowels ,words whites, digits, others.

/*   counting of no of vowels ,words whites, digits, others */ 
         
#include<stdio.h>
#include<conio.h>
main()
{
  char a[80],c;
  int i=0,ove=0,con=0,dig=0,whit=0,words=0,othe=0;
  printf("\n enter the string ");
  scanf("%s",a);
  while((c==tolower(a[i++])!='\0'))
  {
    if((c=='a')||(c=='e')||(c=='i')||(c=='o')||(c=='u'))
      ove++;
    else if((c>='a')&&(c<='z'))
      con++;
    else if((c>='0')&&(c<='9'))
     dig++;
     else if(c=='\0')
      {
       whit++;
       words++;
       while((a[i++]==' ')||(a[i++]=='\t'))
       {
    whit++;
    i++;
       }
      }
    else
      othe++;
  }
  whit++;
  printf("\n ove=%d\ncon=%d\ndig=%d\nwhit=%d\nwords=%d\nothe=%d\n",ove,con,dig,whit,words,othe);
  getch();
}

No comments:

Post a Comment