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 / jethvamohit
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 = "";
}
Console.Write(abc);
Console.ReadLine();
}
}
}
| Is This Answer Correct ? | 4 Yes | 1 No |
Post New Answer View All Answers
which feature are not hold visual basic of oop?
What is object and class in oops?
Can a destructor be called directly?
What are oops functions?
What is overloading in oop?
Why oops is important?
Prepare me a program for the animation of train
What is class and object with example?
Which language is not a true object oriented programming language?
What are the three parts of a simple empty class?
What is purpose of inheritance?
What is the real time example of encapsulation?
Will I be able to get a picture in D drive to the c++ program? If so, help me out?
What is the example of polymorphism?
Who invented oop?