Write a C# Sharp program to insert a given string into middle of the another given string of length 4

  • برمجة سي شارب
  • برمجة

Write a C# Sharp program to insert a given string into middle of the another given string of length 4

Sample Output:

[[Hello]]
((Hi))

الأجوبة

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace exercises
{
   class Program
    {       
        static void Main(string[] args)
        {
            Console.WriteLine(test("[[]]","Hello"));
            Console.WriteLine(test("(())", "Hi"));
            Console.ReadLine();
        }
  public static string test(string s1, string word)
         {
            return s1.Substring(0, 2) + word + s1.Substring(2);
         }
  }
}
هل كان المحتوى مفيد؟

تبحث عن مدرس اونلاين؟

محتاج مساعدة باختيار المدرس الافضل؟ تواصل مع فريقنا الان لمساعدتك بتأمين افضل مدرس
ماهو التخصص الذي تبحث عنه؟
اكتب هنا...