Check out the first build of the new program in C#
Editor : Csharp pad compiler online
/*
Read input string and convert to uppercase
Find the input string length
If odd remove the Median letter else no change
If forward string = reverse string then string is a palindrome ๐️
*/
string input_str="malaalam";
int _n = input_str.Length - 1;
int _mo= (int) (_n / 2);
Console.WriteLine( "111=" + _mo.ToString()) ;
string s1=input_str.Substring(0,((_mo)));
Console.WriteLine( "s1=" + s1.ToString()) ;
string s2= input_str.Substring((_mo )+1,_mo);
Console.WriteLine( "s2=" + s2.ToString()) ;
if(_n%2==1){input_str=s1+s2;}
if(input_str==input_str.Reverse()){
Console.WriteLine("String is a palindrome");}
else{
Console.WriteLine("String is not a palindrome");
}
๐ก๐ก๐ก
Comments