<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DZone Snippets: GCD code</title>
    <link>http://snippets.dzone.com/posts</link>
    <pubDate>Thu, 21 Aug 2008 01:47:37 GMT</pubDate>
    <description>DZone Snippets: GCD code</description>
    <item>
      <title>Greatest Common Denominator function</title>
      <link>http://snippets.dzone.com/posts/show/4255</link>
      <description>This function returns the greatest common denominator (GCD) of its arguments.&lt;br /&gt;&lt;code&gt;&lt;br /&gt;int gcd(int x, int y) {&lt;br /&gt; int a, b;&lt;br /&gt; if (x&lt;y) {a = y; b = x; }&lt;br /&gt; else if (x&gt;y) {a = x; b = y; }&lt;br /&gt; else {return x; }&lt;br /&gt; do {&lt;br /&gt;  int r = a % b;&lt;br /&gt;  a = b;&lt;br /&gt;  b = r;&lt;br /&gt; } while (b != 0);&lt;br /&gt; return a;&lt;br /&gt;}&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Thu, 05 Jul 2007 03:37:26 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/4255</guid>
      <author>Minimiscience (Guildorn Tanaleth)</author>
    </item>
  </channel>
</rss>
