Welcome to collectivesolver - Programming & Software Q&A with code examples. A website with trusted programming answers. All programs are tested and work.

Contact: aviboots(AT)netvision.net.il

Prodentim Probiotics Specially Designed For The Health Of Your Teeth And Gums

Instant Grammar Checker - Correct all grammar errors and enhance your writing

Teach Your Child To Read

Powerful WordPress hosting for WordPress professionals

Disclosure: My content contains affiliate links.

31,111 questions

40,781 answers

573 users

How to find the biggest dividers of two number in C#

1 Answer

0 votes
using System;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            int a = 60, b= 72, big = 0;

            for (int i = 1; i <= a / 2; i++)
            {
                if (a % i == 0 && b % i == 0)
                {
                    Console.Write("{0, 4}", i);
                    big = i;
                }
            }
            Console.WriteLine("\nThe biggest dividers of two number is: {0}", big);
        }
    }
}




answered Apr 10, 2014 by avibootz

Related questions

1 answer 143 views
1 answer 94 views
1 answer 108 views
1 answer 91 views
1 answer 119 views
...