dosseva

FUND_08. Magic Sum

Mar 7th, 2021 (edited)
676
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.64 KB | None | 0 0
  1. using System;
  2. using System.Linq;
  3.  
  4. namespace _08_MagicSum
  5. {
  6.     class Program
  7.     {
  8.         static void Main(string[] args)
  9.         {
  10.             int[] input = Console.ReadLine().Split().Select(int.Parse).ToArray();
  11.             int num = int.Parse(Console.ReadLine());
  12.  
  13.             for (int i = 0; i < input.Length - 1; i++)
  14.             {
  15.                 for (int j = i + 1; j < input.Length; j++)
  16.                 {
  17.                     if (input[i] + input[j] == num)
  18.                     {
  19.                         Console.WriteLine(input[i] + " " + input[j]);
  20.                     }
  21.                 }
  22.             }
  23.         }
  24.     }
  25. }
Add Comment
Please, Sign In to add comment