Experiment Title: Let Be The Two Numbers Let and Repeat Steps 2 and 3 Until Is Greater Than 0 GCD B
Experiment Title: Let Be The Two Numbers Let and Repeat Steps 2 and 3 Until Is Greater Than 0 GCD B
1. Aim/Overview of the practical:Code and Analyze to compute the greatest common divisor
(GCD) of two numbers
#include <iostream>
using namespace std;
if (a == b)
return a;
if (a > b)
return gcd(a-b, b);
return gcd(a, b-a);
}
int main()
{
int a = 92, b = 86;
cout<<"GCD of "<<a<<" and "<<b<<" is "<<gcd(a, b);
return 0;
}
6. Result/Output/Writing Summary:
Learning outcomes (What I have learnt):