Advertisement
Guest User

Untitled

a guest
Feb 24th, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. string input = Console.ReadLine();
  2. string[] tokens = input.Split(' ');
  3. int[] masiv = Array.ConvertAll<string, int>(tokens, int.Parse);
  4. int a = masiv.Length / 2;
  5. if (masiv.Length == 1)
  6. {
  7. Console.WriteLine("{0 }", masiv[0]);
  8. }
  9. else if (masiv.Length%2 == 0)
  10. {
  11. Console.Write("{0 } ", masiv[a - 1]);
  12. Console.Write("{0 } ", masiv[a]);
  13.  
  14. }
  15. else
  16. {
  17. Console.Write("{0 } ", masiv[a - 1]);
  18. Console.Write("{0 } ", masiv[a]);
  19. Console.Write("{0 } ", masiv[a + 1]);
  20.  
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement