Non-recursive Iteration and Recursion/Lab1.c
int gcd(unsigned int x, unsigned int y){
    int results = 1;  //results is init. to 1 because all numbers have 1 as a divisor except 0
    int max;  //the max num of the 2 integers
    
    if(y == 0) return x;  //base case
    
    max = x > y ? x : y;  //calculates the max of the 2 integers
    
    //determines the GCD of the 2 integers by looping through the count of the max 
    for(unsigned int i = 1; i <= max; i++){
        //if the x or y MOD i == 0, then the GCD is the count. ie. i
        if((x % i == 0) && (y % i == 0)){
            results = i;
        }
    }
   
    return results;
}
/*
  gcd: calculates the greatest common divisor of 2 given positive integer
  Input: 2 positive integers: x, y
  Output: result (the gcd of the 2 integers)
*/
calculates the greatest common divisor of 2 given positive integer
Input: 2 positive integers: x, y
Output: result (the gcd of the 2 integers)
calculates the greatest common divisor of 2 given positive integer Input : 2 positive integers : x y Output : result ( the gcd of the 2 integers )
int gcd(unsigned int x, unsigned int y){
    int results = 1;  
    int max;  
    if(y == 0) return x;  
    max = x > y ? x : y;  
    for(unsigned int i = 1; i <= max; i++){
        if((x % i == 0) && (y % i == 0)){
            results = i;
        }
    }
    return results;
}
int gcd ( unsigned int x , unsigned int y ) { int results = 1 ; int max ; if ( y == 0 ) return x ; max = x > y ? x : y ; for ( unsigned int i = 1 ; i <= max ; i ++ ) { if ( ( x % i == 0 ) && ( y % i == 0 ) ) { results = i ; } } return results ; }
gcd: calculates the greatest common divisor of 2 given positive integer
Input: 2 positive integers: x, y
Output: result (the gcd of the 2 integers)
gcd : calculates the greatest common divisor of 2 given positive integer Input : 2 positive integers : x y Output : result ( the gcd of the 2 integers )
//results is init. to 1 because all numbers have 1 as a divisor except 0 //the max num of the 2 integers //base case //calculates the max of the 2 integers //determines the GCD of the 2 integers by looping through the count of the max  //if the x or y MOD i == 0, then the GCD is the count. ie. i