Removing all e by x in a string.

                        Removing all e by x in string.

Hello,friends in this tutorial you will come across the concept that how to remove all e by x in a string.This is simple programme and general programme in c language.



                       




                                   Following method has used in programme

  1. Take one input string from user.
  2. Find the length of string using strlen() function.
  3. Run the iteration till the length of string.
  4. Apply the condition of finding e or E in string.
  5. If the condition success then remove e by x .
  6. Then print the new string.


                                       Removing all e by x



#include<stdio.h>
#include<conio.h>
#include<string.h>
void main()
{
    clrscr();
char str[30];
int i,len=0;
printf("Enter string\n");
gets(str);
len=strlen(str);
for(i=0;i<len;i++)
{
     if(str[i]=='e'||str[i]=='E')
      {
              str[i]=x;
      }
}
printf("String after removing e or E is :%s",str);
getch();
}




output will be like this:
Enter string
DeEpak
String after removing e or E is:Dxxpak

Removing all e by x in a string. Removing all e by x in a string. Reviewed by Deepak kumar soni on December 22, 2018 Rating: 5

No comments:

Powered by Blogger.