Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Linq;
- namespace _9._ArrayValuesTimes10
- {
- class Program
- {
- static void Main(string[] args)
- {
- var array = Console.ReadLine()
- .Split(',')
- .Select(int.Parse)
- .ToArray();
- var index = int.Parse(Console.ReadLine());
- Console.WriteLine(IsEqualWhenMultiplyBy10(array, index));
- }
- static string IsEqualWhenMultiplyBy10(int [] array, int index)
- {
- if (array.Length-1 == index)
- {
- return "false";
- }
- if(array[index+1]/10 ==array[index] )
- {
- return "true";
- }
- return IsEqualWhenMultiplyBy10(array, index + 1);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment