Thursday, July 23, 2009

PROGRAM TO INPUT A SENTENCE AND DELETE ALL VOWELS PRESENT IN IT

#include "stdio.h"
#include "conio.h"

void main()
{
char msg[81],temp[81];
int i=0,j=0;
clrscr();
printf("Write Something...\n");
scanf("%[^\n]",msg);

while(msg[i]!='\0')
{
if(msg[i]!='a'&&msg[i]!='A'&&msg[i]!='e'&&msg[i]!='E'&&msg[i]!='i'&&msg[i]!='I'&&msg[i]!='o'
&&msg[i]!='O'&&msg[i]!='u'&&msg[i]!='U')
temp[j++]=msg[i]; /* Copying to Temporary Variable */
i++;
}
temp[j]='\0'; /* Ends the String with Terminating Null Character */

j=0;
while(temp[j]!='\0')
msg[j++]=temp[j];

msg[j]='\0'; /* Indicates the End of String */
printf("\n%s",msg);
getch();
}

0 comments:


by Ankit Pokhrel.