nassss

Untitled

Mar 11th, 2020
174
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. using System;
  2. using System.Linq;
  3.  
  4. namespace _9._ArrayValuesTimes10
  5. {
  6. class Program
  7. {
  8. static void Main(string[] args)
  9. {
  10. var array = Console.ReadLine()
  11. .Split(',')
  12. .Select(int.Parse)
  13. .ToArray();
  14. var index = int.Parse(Console.ReadLine());
  15.  
  16. Console.WriteLine(IsEqualWhenMultiplyBy10(array, index));
  17. }
  18. static string IsEqualWhenMultiplyBy10(int [] array, int index)
  19. {
  20. if (array.Length - 1 == index)
  21. {
  22. return "false";
  23. }
  24. if(array[index]*10 == array[index+1])
  25. {
  26. return "true";
  27. }
  28. return IsEqualWhenMultiplyBy10(array, index + 1);
  29. }
  30. }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment