Write a function that will print all possible combinations of the given array??
ex:- if given array is : int[] arr={1,2,3,4,5}
It should print all the combinations of elements present in the array
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Karthikeyan KRank #554 · 4.4K reputationPosted Aug 25, 2015, 9:19 PM EDT
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Configuration;
class Program
{
static void Main(string[] args)
{
int[] Arr = { 1, 2, 3, 4, 5 };
var combo = from a in Arr
from b in Arr
from c in Arr
select string.Concat(a,b,c);
foreach (var v in combo)
{
Console.WriteLine(v);
}
Console.ReadKey();
}
}
Rajeesh MenothRank #118 · 18.4K reputationPosted Aug 25, 2015, 8:34 PM EDT
Rajeesh MenothRank #118 · 18.4K reputationPosted Aug 25, 2015, 10:00 PM EDT