namespace palidromeDepth
{
internal class Program
{
static void Main(string[] args)
{
}
void int palidromCheck(int depth, int number)
{
Program program = new Program(); // Defines program
string reversed = program.Reverse(Convert.ToString(number); // Supposed to get a reverse of the number
if (Convert.ToString(number) == reversed)
{
return depth; // returns all and sends depth to the user
}
else
{
return palidromCheck(depth+1, number+Convert.ToInt16(reversed)); // Runs the module again
}
}
static string Reverse(string word)
{
// Converts to Array, reverses array, then converts back to string
char[] charArray = word.ToCharArray();
Array.Reverse(charArray);
return new string(charArray); // SHOULD return reversed string
}
}
}
namespace palidromeDepth
{
internal class Program
{
static void Main(string[] args)
{
}
void int palidromCheck(int depth, int number)
{
Program program = new Program(); // Defines program
string reversed = program.Reverse(Convert.ToString(number); // Supposed to get a reverse of the number
if (Convert.ToString(number) == reversed)
{
return depth; // returns all and sends depth to the user
}
else
{
return palidromCheck(depth+1, number+Convert.ToInt16(reversed)); // Runs the module again
}
}
static string Reverse(string word)
{
// Converts to Array, reverses array, then converts back to string
char[] charArray = word.ToCharArray();
Array.Reverse(charArray);
return new string(charArray); // SHOULD return reversed string
}
}
}