Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- class Program
- {
- static void Main(string[] args)
- {
- string st = Console.ReadLine();
- MiddleChar(st);
- }
- public static void MiddleChar(string st)
- {
- if(st.Length%2!=0)
- {
- Console.WriteLine(st[st.Length/2]);
- }
- else
- {
- Console.WriteLine($"{st[st.Length/2-1]}{st[st.Length/2]}");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement