MY CODE >> Euclidean Algorithm
/* Tommy Martin
 * 11/15/2012
 * 
 * Euclidean Algorithm
 * Finds the greatest common devisor
 *
 * Program.cs
 */

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace EuclideanAlgorithm
{
    class Program
    {
        static void Main(string[] args)
        {
            
            EACalc starter = new EACalc();

            Console.Write("Please enter p: ");
            int p = Convert.ToInt32(Console.ReadLine());

            Console.Write("Please enter q: ");
            int q = Convert.ToInt32(Console.ReadLine());

            Console.Write("Please enter n: ");
            int n = Convert.ToInt32(Console.ReadLine());



            Console.WriteLine(starter.CalcGCD(n, p*q));

            Console.Write("\nPress any key to continue...");
            Console.ReadLine();

        }
    }
}
/* Tommy Martin
 * 11/15/2012
 * 
 * The pseudocode for this algorithm was copied from
 * Richard Johnsonbaugh's
 * Discrete Mathematics, Seventh Edition, page 249 Algorithm 5.3.3
 * 2009 by Pearson Education, Inc: Upper Saddle River, NJ
 *
 * EACalc.cs
 */

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace EuclideanAlgorithm
{
    class EACalc
    {
        public int CalcGCD(int a, int b)
        {

            int r = 0;  // storage variable

            if (a < b)
            {
                int c = a;
                a = b;
                b = c;
            }

            while (b != 0)
            {
                r = a % b;
                a = b;
                b = r;
            }

            return a;
        }
    }
}