Advertisement
Guest User

Untitled

a guest
Oct 15th, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.82 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.  
  7. namespace _8.Magic_Sum
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             int[] numbers = Console.ReadLine()
  14.                 .Split().
  15.                 Select(int.Parse)
  16.                 .ToArray();
  17.  
  18.             int number = int.Parse(Console.ReadLine());
  19.  
  20.             for (int i = 0; i < numbers.Length; i++)
  21.             {
  22.                 for (int j = 0; j < numbers.Length; j++)
  23.                 {
  24.                     if (numbers[i] + numbers[j] == number)
  25.                     {
  26.                         Console.WriteLine($"{numbers[i]} {numbers[j]}");
  27.                        
  28.                     }
  29.                 }
  30.             }
  31.  
  32.  
  33.         }
  34.     }
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement