in Technology by
How to reverse a string in c# console application?

1 Answer

0 votes
by
Below is the code to reverse the string first i have put the string in char[] datatypes. And after that using for loop we have reverse the string character by character. Here i have use console application.

internal static void RevStr(string str)
{
   char[] charOfArray = str.ToCharArray();
   for (int i = 0, j = str.Length - 1; i < j; i++, j--)
   {
     charOfArray[i] = str[j];
     charOfArray[j] = str[i];
   }
   string reversestring = new string(charOfArray);
   Console.WriteLine(reversestring);
}

Related questions

0 votes
    I am very new to creating and consuming REST web services in C#. I have programmed the data I ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 20, 2022 in Education by JackTerrance
0 votes
    Auto-configuration report can be logged to the console by enabling debug mode while starting the application. A. True B. False...
asked Nov 8, 2022 in Education by JackTerrance
0 votes
    I am currently working on a personal project in C++, and I'm having a lot of fun learning. I just learned some ... MainMenu::~MainMenu(){} void MainMenu::displayMenu() { std::cout...
asked May 3, 2022 in Education by JackTerrance
0 votes
    How can I reverse a str object in Python? Select the correct answer from above options...
asked Jan 22, 2022 in Education by JackTerrance
0 votes
    Write a program to take a string parameter (st) of a function reversing(). Reverse the sentence in sucha way so ... None Hate All Love Select the correct answer from above options...
asked Dec 19, 2021 in Education by JackTerrance
0 votes
    String Slicing means: 1.to convert the string in capital 2.to check whether a string has more than one ... in reverse order computet Select the correct answer from above options...
asked Dec 13, 2021 in Education by JackTerrance
0 votes
    im developing a c# application (Photo Album Viewer), Im having Picturebox (Displays the selected image in ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 2, 2022 in Education by JackTerrance
0 votes
    How can you strip non-ASCII characters from a string? (in C#) JavaScript questions and answers, JavaScript ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 19, 2022 in Education by JackTerrance
0 votes
    How to download the Console log for a particular Jenkins build programmatically?...
asked Jul 17, 2021 in Technology by JackTerrance
0 votes
    How to print to console javascript?...
asked Dec 10, 2020 in Technology by JackTerrance
0 votes
    What is Search Console and how to link with Google Analytics? ...
asked Oct 3, 2020 in Technology by JackTerrance
0 votes
    What is meant by reverse polarity and how it can be fixed?...
asked Dec 14, 2020 in Technology by JackTerrance
0 votes
    How will you reverse a list in Python?...
asked Nov 26, 2020 in Technology by JackTerrance
0 votes
    I am building an Android application with Cordova which is running inside a webview. I know I can access ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 14, 2022 in Education by JackTerrance
0 votes
    When writing j2me applications for cellphones, using System.out.println() prints on the console if using an ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 16, 2022 in Education by JackTerrance
...