Advertisement
Guest User

Untitled

a guest
Jun 5th, 2021
170
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.77 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using System.Numerics;
  7.  
  8. namespace TestingSoftUni
  9. {
  10.     class Program
  11.     {
  12.         static void Main(string[] args)
  13.         {
  14.  
  15.             int[] array = Console.ReadLine().Split().Select(int.Parse).ToArray();
  16.  
  17.             int magicNumber = int.Parse(Console.ReadLine());
  18.  
  19.             for (int i = 0; i < array.Length; i++)
  20.             {
  21.                 for (int j = i; j < array.Length; j++)
  22.                 {
  23.                     if(i != j && array[i] + array[j] == magicNumber)
  24.                     {
  25.                         Console.WriteLine($"{array[i]} {array[j]}");
  26.                     }
  27.                 }
  28.  
  29.             }
  30.         }
  31.     }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement