Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int[] nums = Console.ReadLine().Split().Select(int.Parse).ToArray();
- int start = int.Parse(Console.ReadLine());
- int end = int.Parse(Console.ReadLine());
- int max = int.MinValue;
- int min = int.MaxValue;
- for (int i = start; i <= end; i++)
- {
- if (nums[i] > max)
- max = nums[i];
- if (nums[i] < min)
- min = nums[i];
- }
- int sum = max + min;
- Console.WriteLine(sum);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement