File tree Expand file tree Collapse file tree 2 files changed +31
-0
lines changed
Learn_CPP_Programming_Deep_Dive/Section 7 Loops/Program_for_finding_greatest_common_divisor Expand file tree Collapse file tree 2 files changed +31
-0
lines changed Original file line number Diff line number Diff line change
1
+ #include < iostream>
2
+
3
+ using namespace std ;
4
+
5
+ int main ()
6
+ {
7
+ cout<<" Enter the numbers to check for the greatest common divisor" <<endl;
8
+
9
+ int initial_m, initial_n;
10
+ cin>>initial_m>>initial_n;
11
+
12
+ int n, m;
13
+ m = initial_m;
14
+ n = initial_n;
15
+
16
+ while (m!=n)
17
+ {
18
+ if (m>n)
19
+ {
20
+ m = m-n;
21
+ }
22
+ else if (n>m)
23
+ {
24
+ n = n-m;
25
+ }
26
+ }
27
+ cout<<" The greatest common divisor of the numbers " <<initial_m<<" and " <<initial_n<<" is " <<n<<endl;
28
+
29
+ return 0 ;
30
+ }
Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ The content within this repository is my own work produced as a result of comple
8
8
![ Course Info] ( 2023-10-19_17-30-00.png )
9
9
10
10
## IDE used
11
+ Visual Studio Code
11
12
12
13
### About me
13
14
* George Calin
You can’t perform that action at this time.
0 commit comments