Tuesday, 5 February 2013

Write a c program to accept a string from user, delete all vowels from that string & display the result



#include<stdio.h>
#include<conio.h>
#include<string.h>
#include<stdlib.h>
  void main()
{
  char str[30],str1[30],c;
  int i,count=0;
  clrscr();
  printf("\nEnter any string: ");
  gets(str);
  for(i=0;i<strlen(str);i++)
{
  c=str[i];
  if(c!='a' && c!='e' && c!='i' && c!='o' && c!='u')
{
  str1[count++]=str[i];
}
}
  str1[count]='\0';
  printf("\nYou entered string is: %s",str);
  printf("\nString without vowels is: %s",str1);
  getch();
}

//OUTPUT:

//Enter any string: VINIT
//You entered dtring is: VINIT
//String without vowels is: VNT

No comments:

Post a Comment