Thursday 9 May 2013

Delete vowels from a string



DESCRIPTION: This program makes use of the keyword continue to delete the vowels present in the string.
The continue statement passes control to the next iteration of the nearest enclosing dofor, or while statement in which it appears, bypassing any remaining statements in the dofor, or while statement body.


PROGRAM:

#include<stdio.h>
main()
{
  char a[50],b[50],i,j;
  printf("enter string\n");
  gets(a);
  for(i=0,j=0;a[i]!='\0';i++)
  {
      if(a[i]=='a'||a[i]=='e'||a[i]=='i'||a[i]=='o'||a[i]=='u'||a[i]=='A'||a[i]=='E'||a[i]=='I'||a[i]=='O'||a[i]=='U')
      continue;
      b[j]=a[i];
      j++;
  }
  b[j]='\0';
  puts(b);
}


OUTPUT WINDOW:






No comments:

Post a Comment