Least Common Denominator (LCD) in C++
I'm reposting this blog from my old blogsite which I have not been maintaining for long period of time. A friend of mine asked me to give him code of LCD(Least Common Denominator) program in C++ via text. I Googled and I found the ff. (sorry I forgot the website) code with some modification myself: #include <iostream> using namespace std; int main() { int a, b, d, min; cout << "Enter first number: "; cin >> a; cout << "Enter second number: "; cin >> b; min = a > b ? b : a; for(d = 2; d<min; d++) { if(((a%d)==0) && ((b%d)==0)) break; if(d==min) { cout << "No common denominators." << endl; ...