Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- class CompareWords
- {
- static void Main(string[] args)
- {
- int z = 0;
- Console.WriteLine("Write first word ");
- string firstWord = Console.ReadLine();
- char[] firstArray = new char[firstWord.Length];
- for (int i = 0; i < firstWord.Length; i++)
- {
- firstArray[i] = firstWord[i];
- }
- Console.WriteLine("Write second word ");
- string secondWord = Console.ReadLine();
- char[] secondArray = new char[secondWord.Length];
- for (int i = 0; i < secondWord.Length; i++)
- {
- secondArray[i] = secondWord[i];
- }
- if (firstWord.Length > secondWord.Length)
- {
- z = firstWord.Length;
- }
- else
- {
- z = secondWord.Length;
- }
- for (int i = 0; i < z; i++)
- {
- bool compare = firstArray[i] == secondArray[i];
- Console.WriteLine(firstArray[i] + " = " + secondArray[i] + " is " + compare);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement