Write a c program to accept a string from user, delete all vowels from that string and display result
#include<stdio.h>
#include<conio.h>
#include<string.h>
#include<stdlib.h>
void main()
{
char str1[30],str2[30],c;
int i,count=0;
clrscr();
printf("\n Enter any string from user:-- ");
gets(str1);
for(i=0;i<strlen(str1);i++)
{
c=str1[i];
if(c!='a' && c!='e' && c!='i' && c!='o' && c!='u')
{
str2[count++]=str1[i];
}
}
str1[count]='\0';
printf("\n You entered string is:- %s",str1);
printf("\n String without vowels is:- %s",str2);
getch();
}
printf("\n Enter any string from user:-- ");
gets(str1);
for(i=0;i<strlen(str1);i++)
{
c=str1[i];
if(c!='a' && c!='e' && c!='i' && c!='o' && c!='u')
{
str2[count++]=str1[i];
}
}
str1[count]='\0';
printf("\n You entered string is:- %s",str1);
printf("\n String without vowels is:- %s",str2);
getch();
}
#include<conio.h>
#include<string.h>
#include<stdlib.h>
void main()
{
char str1[30],str2[30],c;
int i,count=0;
clrscr();
printf("\n Enter any string from user:-- ");
gets(str1);
for(i=0;i<strlen(str1);i++)
{
c=str1[i];
if(c!='a' && c!='e' && c!='i' && c!='o' && c!='u')
{
str2[count++]=str1[i];
}
}
str1[count]='\0';
printf("\n You entered string is:- %s",str1);
printf("\n String without vowels is:- %s",str2);
getch();
}
printf("\n Enter any string from user:-- ");
gets(str1);
for(i=0;i<strlen(str1);i++)
{
c=str1[i];
if(c!='a' && c!='e' && c!='i' && c!='o' && c!='u')
{
str2[count++]=str1[i];
}
}
str1[count]='\0';
printf("\n You entered string is:- %s",str1);
printf("\n String without vowels is:- %s",str2);
getch();
}
0 comments:
Post a Comment
Note: only a member of this blog may post a comment.