Skip to content
This repository has been archived by the owner on Oct 23, 2018. It is now read-only.

Added GCD_Calculate.cpp #815

Merged
merged 1 commit into from
Oct 8, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions C++/GCD_Calculate.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#include <iostream>
using namespace std;

int main()
{
int n1, n2;

cout << "Enter two numbers: ";
cin >> n1 >> n2;

while(n1 != n2)
{
if(n1 > n2)
n1 -= n2;
else
n2 -= n1;
}

cout << "HCF = " << n1;
return 0;
}