firstly i would like to say sorry because of very easy question for you guys , as i am beginner , i am trying to write a program to take input in a string and reverse it in new string , so i can compare if both strings are same than it is palindrome..
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Assg2_question1
{
class Program
{
static void Main(string[] args)
{
string word, reverse ="";
Console.WriteLine("type any word to check if it palindrome or not");
word = Console.ReadLine();
int lengthOfWord, i;
lengthOfWord = word.Length;
for(i=lengthOfWord ; i>=1 ; i-- )
{
reverse = word[lengthOfWord];
}
}
}
}
i have two string word and reverse , when i try to reverse the string it shows error on reverse = word[lengthOfWord]; can not implicitly convert type char to string, why is that ? because i never use char in my program