static void Main(string[] args)
{
/*
8. Write a program in C# Sharp to check whether a given string is Palindrome or not using recursion. Go to the editor
Test Data :
Input a string : RADAR
Expected Output :
The string is Palindrome.
*/
Console.WriteLine(ReverseLetters("RADAR"));
}
private static bool ReverseLetters(string word)
{
if (word.Length > 1 && word[0] == word[word.Length - 1])
{
ReverseLetters(word.Substring(1, word.Length - 2));
return true;
}
return false;
}
static void Main(string[] args)
{
/*
8. Write a program in C# Sharp to check whether a given string is Palindrome or not using recursion. Go to the editor
Test Data :
Input a string : RADAR
Expected Output :
The string is Palindrome.
*/
Console.WriteLine(ReverseLetters("RADAR"));
}
private static bool ReverseLetters(string word)
{
if (word.Length > 1 && word[0] == word[word.Length - 1])
{
ReverseLetters(word.Substring(1, word.Length - 2));
return true;
}
return false;
}