Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace ConsoleApp2
- {
- class Program
- {
- static void Main(string[] args)
- {
- int probel1 = 1, probel2 = 1;
- Console.WriteLine("Введите два слова через пробел");
- string s = Console.ReadLine();
- char[] arr = s.ToCharArray();
- for (int i = 1; i < arr.Length; i++)
- {
- if (arr[i] == ' ')
- {
- if (probel1 <= 1) { probel1 = i; probel2 = i; }
- else probel2 = i;
- }
- }
- Console.WriteLine("Введите количество букв второго слова");
- int numb = int.Parse(Console.ReadLine());
- if (arr[probel1 - 1] == arr[probel2 + numb]) Console.WriteLine("{0} и {1} совпадают", s[probel1 - 1], s[probel2 + numb]);
- else Console.WriteLine("{0} и {1} не совпадают", s[probel1 - 1], s[probel2 + numb]);
- Console.ReadLine();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement