From 7a73162607544204032aa66cce755daf21edebda Mon Sep 17 00:00:00 2001 From: Matt Strapp Date: Tue, 24 May 2022 11:18:46 -0500 Subject: Graduate Signed-off-by: Matt Strapp --- OLD/ee1301/wk3/lab3/gcd.cpp | 36 ------------------------------------ 1 file changed, 36 deletions(-) delete mode 100644 OLD/ee1301/wk3/lab3/gcd.cpp (limited to 'OLD/ee1301/wk3/lab3/gcd.cpp') diff --git a/OLD/ee1301/wk3/lab3/gcd.cpp b/OLD/ee1301/wk3/lab3/gcd.cpp deleted file mode 100644 index 4e127d9..0000000 --- a/OLD/ee1301/wk3/lab3/gcd.cpp +++ /dev/null @@ -1,36 +0,0 @@ -#include -#include -using namespace std; - -int GCD(int a, int b) { - int gcd=1; - a=abs(a); b=abs(b); - if (a>b) { - //do nothing - } else { - if (b>a) { - int foo=a; a=b; b=foo; - } else { - return -1; - } - } - gcd=(a%b); - while (gcd!=0) { - return GCD(b,gcd); - } - return b; - -} -int main () { - int a=0, b=0; - char cont; - do { - cout << "enter two integer values: "; - cin >> a >> b; - cout << "greatest common divisor is: " << GCD(a,b) << endl; - cout << "continue? (y/n): "; - cin >> cont; - cout << endl; - } while (cont!='n'); - -} -- cgit v1.2.3