Given two strings like x=?hello? and y=?open?, remove any
character from string x which is also used in string y,
thus making the result x=?hll?.
Answer Posted / preeti
Lttle correction in above answer.
using System;
using System.Collections.Generic;
using System.Text;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
string str = "mohim";
string str1 = "mo";
remove(str, str1);
}
private static void remove(string str,string str1)
{
char[] abc;
abc = str.ToCharArray();
char[] bcd;
string str4 = "";
bcd = str1.ToCharArray();
for (int i = 0; i < bcd.Length; i++)
{
for (int j = 0; j < abc.Length; j++)
{
if (abc[j] != bcd[i])
{
str4 = str4 + abc[j];
}
}
abc = str4.ToCharArray();
str4 = "";
}
str = "";
for (int j = 0; j < abc.Length; j++)
{
str = str + abc[j];
}
Console.Write("str : ");
Console.Write(str)
}
}
}
output will be
------------------------
str : hi
| Is This Answer Correct ? | 2 Yes | 0 No |
Post New Answer View All Answers
What is polymorphism what is it for and how is it used?
What is inheritance in oop?
Why do we use oop?
Following are the class specifications: class {int a}; class {int b}; Using friend funtion,calculate the max of two objects and display it.
What are the three parts of a simple empty class?
What does and I oop mean in text?
What is the difference between a constructor and a destructor?
i got a backdoor offer in process global,Bangalore..Can i work with it?
How do you define a class in oop?
what's the basic's in dot net
What is interface in oop?
What are main features of oop?
What is overloading and its types?
What is the main feature of oop?
What is the real life example of polymorphism?