I wrote this program like the title says but it says system.char[]
for some reason.
using System;
public class q2
{
public static void upperNreverse(string inp)
{
char[] inpChar = inp.ToCharArray();
Array.Reverse(inpChar);
string inpString = Convert.ToString(inpChar);
string finalString = inpString.ToUpper();
Console.WriteLine(finalString);
}
public static void Main()
{
Console.WriteLine("Please enter the string to convert to uppercase");
string inp = Console.ReadLine();
upperNreverse(inp);
}
}
2
Answers
Convert.ToString()
is not suitable for converting a char array to a string. Use the constructornew string(char[])
Change
to
Use this code,
This is
string inpString = Convert.ToString(inpChar);
not the correct format for converting the char[] to string.Use these code