From db0f0eab112050c0f455f0be04227859f925ad6a Mon Sep 17 00:00:00 2001 From: Shaquille Soekhlal Date: Wed, 11 Sep 2019 11:08:22 +0200 Subject: [PATCH] Working code but assignment wants me to use a loop --- Assignment 5/main.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 Assignment 5/main.c diff --git a/Assignment 5/main.c b/Assignment 5/main.c new file mode 100644 index 0000000..64bb724 --- /dev/null +++ b/Assignment 5/main.c @@ -0,0 +1,25 @@ +/* + * Student: S.K. Soekhlal + * Number: 4860632 + * Assignment: 3.4 + */ + +#include +#include + +int gcd (int p, int q) +{ + int r; + + if ((r = p % q) == 0) + return q; + else + return gcd (q, r); +} + +int main(){ + int a,b; + scanf("%d%d",&a,&b); + printf("%d\n",gcd(a,b)); + return 0; +} \ No newline at end of file