Search This Blog

Friday, October 7, 2011

Write a program to read a num of char and count the num of vowels

   1:  #include<stdio.h>
   2:  #include<conio.h>
   3:  void main()
   4:  {
   5:  int i,n,count=0;
   6:  char c;
   7:  printf("Enter the set num of char:\n");
   8:  scanf("%d",&n);
   9:  for(i=1;i<=n;i++)
  10:  {
  11:  printf("\nEnter the character %d:\n",i);
  12:  c=getche();
  13:      if(c=='a'||c=='A'||c=='e'||c=='E'||c=='i'||c=='I'||c=='o'||c=='O'||c=='u'||c=='U')
  14:      {
  15:      count++;
  16:      }
  17:  }
  18:  printf("\nNumber of vowels: %d",count);
  19:  getch();
  20:  }

No comments:

Post a Comment