We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 09688ae commit 9588803Copy full SHA for 9588803
prog.8.5.c
@@ -0,0 +1,28 @@
1
+/* Function to find the greatest common divisor
2
+ of two nonnegative integer values */
3
+
4
+#include <stdio.h>
5
6
+void gcd (int u, int v)
7
+{
8
+ int temp;
9
10
+ printf ("The gcd of %i and %i is ", u, v);
11
12
+ while ( v != 0 ) {
13
+ temp = u % v;
14
+ u = v;
15
+ v = temp;
16
+ }
17
18
+ printf ("%i\n", u);
19
+}
20
21
+int main (void)
22
23
+ gcd (150, 35);
24
+ gcd (1026, 405);
25
+ gcd (83, 240);
26
27
+ return 0;
28
0 commit comments