Jaya Prakash

Jaya Prakash

  • 538
  • 2.3k
  • 67k

logics programing

Sep 15 2022 5:33 AM

how swap adjacent chars in a given string without using string builder or any method

ex::

input: Tapan

output: atapn like 

This is My Code

Console.WriteLine("enter a string");
string sS = Console.ReadLine();
string sss = "";
int i, j;
for (i = 0; i < sS.Length; i++)
{sss += sS[i + 1];sss += sS[i];
}
Console.WriteLine(sss);

Answers (3)