Working code but assignment wants me to use a loop

This commit is contained in:
Shaquille Soekhlal 2019-09-11 11:08:22 +02:00
parent 303f584bbe
commit db0f0eab11

25
Assignment 5/main.c Normal file
View File

@ -0,0 +1,25 @@
/*
* Student: S.K. Soekhlal
* Number: 4860632
* Assignment: 3.4
*/
#include<stdlib.h>
#include<stdio.h>
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;
}