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);
Jaya PrakashPosted Sep 15, 2022, 2:02 PM
Thank you sir for ur help
Uday DodiyaPosted Sep 15, 2022, 8:50 AM
Hi Jaya
Try Following Code, you can get your output
Code 1 :
Code 2 :
Jignesh KumarPosted Sep 15, 2022, 6:49 AM
Hi Jaya Prakash,
Please find below and try to debug and understand,