Q:

Write a C# Sharp program to create a coded string from a given string, using specified formula

0

Write a C# Sharp program to create a coded string from a given string, using specified formula

Replace all 'P' with '9', 'T' with '0', 'S' with '1', 'H' with '6' and 'A' with '8'.

Sample Output:

969
J8V81CRI90

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

using System;
namespace exercises
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine(test("PHP"));
            Console.WriteLine(test("JAVASCRIPT"));
        }
        public static string test(string str1)
        {
            return str1.Replace("P", "9").Replace("T", "0").Replace("S", "1").Replace("H", "6").Replace("A", "8");
        }
    }
}

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now