diff options
| author | RossTheRoss <msattr@gmail.com> | 2020-02-09 08:46:52 -0600 |
|---|---|---|
| committer | RossTheRoss <msattr@gmail.com> | 2020-02-09 08:46:52 -0600 |
| commit | bd1d350c376b45e334697851e29b2f79fee0c956 (patch) | |
| tree | eb242032a64442caef7a35434400eb0818911e9a /ee1301/wk3/lab3/gcd.cpp | |
| parent | Do micro prelab (diff) | |
| parent | Rename file (diff) | |
| download | homework-bd1d350c376b45e334697851e29b2f79fee0c956.tar homework-bd1d350c376b45e334697851e29b2f79fee0c956.tar.gz homework-bd1d350c376b45e334697851e29b2f79fee0c956.tar.bz2 homework-bd1d350c376b45e334697851e29b2f79fee0c956.tar.lz homework-bd1d350c376b45e334697851e29b2f79fee0c956.tar.xz homework-bd1d350c376b45e334697851e29b2f79fee0c956.tar.zst homework-bd1d350c376b45e334697851e29b2f79fee0c956.zip | |
Merge branch 'master' of github.com:RosstheRoss/TestingFun
Diffstat (limited to 'ee1301/wk3/lab3/gcd.cpp')
| -rw-r--r-- | ee1301/wk3/lab3/gcd.cpp | 36 |
1 files changed, 0 insertions, 36 deletions
diff --git a/ee1301/wk3/lab3/gcd.cpp b/ee1301/wk3/lab3/gcd.cpp deleted file mode 100644 index 4e127d9..0000000 --- a/ee1301/wk3/lab3/gcd.cpp +++ /dev/null @@ -1,36 +0,0 @@ -#include <iostream>
-#include <cmath>
-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');
-
-}
|
