Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Diagnostics.CodeAnalysis;
- using System.Linq;
- using System.Numerics;
- namespace SoftuniExercisesWithVariables
- {
- class Program
- {
- static void Main(string[] args)
- {
- Console.WriteLine("Enter your array here: ");
- int[] array = Console.ReadLine().Split(" ").Select(int.Parse).ToArray();
- Console.WriteLine("Enter your number here: ");
- int number = int.Parse(Console.ReadLine());
- for (int i = 0; i < array.Length-1; i++)
- {
- for(int k = i+1; k < array.Length; k++)
- {
- if((array[i] + array[k]) == number)
- {
- Console.WriteLine(array[i] + " " + array[k]);
- }
- }
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment