Program to multiply array of big integers in C#

Rajnilari2015
Posted by Rajnilari2015 under C# category on | Points: 40 | Views : 135
Let's say we have an array of integers like {234,213,666,879}. The objective is to find the multiplication of these numbers.Below program will do so
using System;
using System.Collections.Generic;
using System.Linq;

namespace ConsoleApplication2
{
class Program
{
static void Main(string[] args)
{

var intCollection = new List<System.Numerics.BigInteger>() { 234, 213, 666, 879 };
var product = intCollection.Aggregate((a, b) => a * b);
Console.WriteLine("Product is {0}", product);
Console.ReadKey();
}
}
}


Result
---------
Product is 29178204588

Comments or Responses

Login to post response