Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Linq;
- namespace Pairs_by_Difference
- {
- class Pairs_by_Difference
- {
- static void Main(string[] args)
- {
- int[] array = Console.ReadLine().Split().Select(int.Parse).ToArray();
- int difference = int.Parse(Console.ReadLine());
- int count = 0;
- for (int i = 0; i < array.Length; i++)
- {
- for (int j = 1; j < array.Length; j++)
- {
- if (array[j] - array[i] == difference)
- {
- count++;
- }
- }
- }
- Console.WriteLine(count);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement