using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication1
{
class CalcAvgPerc
{
static void Main(string[] args)
{
int a, b, Num1, Num2, temp, LCM, GCD;
Console.WriteLine("Calculate LCM and GCD\nEnter the two numbers to Calculate..");
a = int.Parse(Console.ReadLine());
b = int.Parse(Console.ReadLine());
Console.WriteLine("Calculating....");
System.Threading.Thread.Sleep(2000);
Num1 = a;
Num2 = b;
while (Num2 != 0)
{
temp = Num2;
Num2 = Num1 % Num2;
Num1 = temp;
}
GCD = Num1;
LCM = (a * b) / GCD;
Console.WriteLine("LCM for {0} and {1} is {2}", a, b, LCM);
Console.WriteLine("GCD for {0} and {1} is {2}", a, b, GCD);
Console.ReadKey();
}
}
}This program for Calculate Lowest Common Multiple And Greatest Common Divisor(Highest Common Factor) in C# language.
