<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: C#: Doing a modulus (mod) operation on a very large number (&gt; Int64.MaxValue)</title>
	<atom:link href="http://www.del337ed.com/blog/index.php/2009/02/04/c-doing-a-modulus-mod-operation-on-a-very-large-number-int64maxvalue/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.del337ed.com/blog/index.php/2009/02/04/c-doing-a-modulus-mod-operation-on-a-very-large-number-int64maxvalue/</link>
	<description>Mostly tech talk</description>
	<lastBuildDate>Tue, 10 Aug 2010 10:51:02 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Jaroslav Kubacek</title>
		<link>http://www.del337ed.com/blog/index.php/2009/02/04/c-doing-a-modulus-mod-operation-on-a-very-large-number-int64maxvalue/comment-page-1/#comment-748</link>
		<dc:creator>Jaroslav Kubacek</dc:creator>
		<pubDate>Thu, 11 Feb 2010 17:59:17 +0000</pubDate>
		<guid isPermaLink="false">http://www.del337ed.com/blog/?p=89#comment-748</guid>
		<description>This is part of code I mage for my shop for IBAN validation. Feel free to use if some one need.

    static void Main(string[] args)
    {
        int modulo = 97;
        string input = Reverse(&quot;100020778788920323232343433&quot;);
        int result = 0;
        int lastRowValue = 1;

        for (int i = 0; i  0)
            {
                lastRowValue = ModuloByDigits(lastRowValue, modulo);
            }
            result += lastRowValue * int.Parse(input[i].ToString());
        }
        result = result % modulo;
        Console.WriteLine(string.Format(&quot;Result: {0}&quot;, result));            
    }

    public static int ModuloByDigits(int previousValue, int modulo)
    {
        // Calculating the modulus of a large number Wikipedia http://en.wikipedia.org/wiki/International_Bank_Account_Number                        
        return ((previousValue * 10) % modulo);
    }
    public static string Reverse(string input)
    {
        char[] arr = input.ToCharArray();
        Array.Reverse(arr);
        return new string(arr);</description>
		<content:encoded><![CDATA[<p>This is part of code I mage for my shop for IBAN validation. Feel free to use if some one need.</p>
<p>    static void Main(string[] args)<br />
    {<br />
        int modulo = 97;<br />
        string input = Reverse(&#8220;100020778788920323232343433&#8243;);<br />
        int result = 0;<br />
        int lastRowValue = 1;</p>
<p>        for (int i = 0; i  0)<br />
            {<br />
                lastRowValue = ModuloByDigits(lastRowValue, modulo);<br />
            }<br />
            result += lastRowValue * int.Parse(input[i].ToString());<br />
        }<br />
        result = result % modulo;<br />
        Console.WriteLine(string.Format(&#8220;Result: {0}&#8221;, result));<br />
    }</p>
<p>    public static int ModuloByDigits(int previousValue, int modulo)<br />
    {<br />
        // Calculating the modulus of a large number Wikipedia <a href="http://en.wikipedia.org/wiki/International_Bank_Account_Number" rel="nofollow">http://en.wikipedia.org/wiki/International_Bank_Account_Number</a><br />
        return ((previousValue * 10) % modulo);<br />
    }<br />
    public static string Reverse(string input)<br />
    {<br />
        char[] arr = input.ToCharArray();<br />
        Array.Reverse(arr);<br />
        return new string(arr);</p>
]]></content:encoded>
	</item>
</channel>
</rss>
