Untitled
unknown
plain_text
3 years ago
907 B
7
Indexable
// Online C# Editor for free
// Write, Edit and Run your C# code using C# Online Compiler
using System;
public class HelloWorld
{
public static void Main(string[] args)
{
Console.WriteLine("Enter a text: ");
string text = Console.ReadLine();
Console.WriteLine("Enter a symbol: ");
var symbol = Console.ReadLine();
char symbolC = Convert.ToChar(symbol[0]);
char[] textC = text.ToCharArray();
char[] textNew = new char[textC.Length];
for (int i = 0; i < textC.Length; i++)
{
if(textC[i] == symbolC)textC[i] = '0';
}
for (int i = 0; i < textC.Length; i++)
{
if(textC[i] != '0')
{
textNew[i] = textC[i];
Console.Write(textNew[i]);
}
}
Console.ReadLine();
}
}Editor is loading...