Horje
multiplication of long number Code Example
multiplication of long number
// basic idea is how would you multiply two number on paper

// 	6534584351565431546351314865641313541354
// 										X  5
// _________________________________________
// 32672921757827157731756574328206567706770 


    public static List<int> Function(string N, int n)
    {
        var num = N.ToCharArray().ToList()
                   .Select(s => Convert
                   .ToInt32(s.ToString()))
                   .ToList();
        num.Reverse();

        // initially remainder is 0
        var remainder = 0;
        for (int i = 0; i < num.Count; i++)
        {
            var temp = num[i] * n + remainder;
            var inString = temp.ToString();

            if (inString.Length > 1)
            {
                num[i] = Convert.ToInt32(inString[1].ToString());
                remainder = Convert.ToInt32(inString[0].ToString());
            }
            else
            {
                num[i]= Convert.ToInt32(inString[0].ToString());
                remainder = 0;
            }
        }
        if(remainder!=0)
        {
            num.Add(remainder);
        }
        num.Reverse();
        return num;
    }
Source: ideone.com




Csharp

Related
Ef Select 2 or more items from DB Code Example Ef Select 2 or more items from DB Code Example
ef select multiple items Code Example ef select multiple items Code Example
long number multiplication Code Example long number multiplication Code Example
How to add a label programatically in c# Code Example How to add a label programatically in c# Code Example
iactionresult Code Example iactionresult Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
12