Professional Documents
Culture Documents
Task 2
Task 2
#include<iostream>
using namespace std;
int gcd(int a, int b) {
if (a == 0 || b == 0)
return 0;
else if (a == b)
return a;
else if (a > b)
return gcd(a - b, b);
else return gcd(a, b - a);
}
int main() {
int a = 64, b = 72;
cout << "GCD of " << a << " and " << b << " is " << gcd(a, b);
system("pause");
}
Task 3
#include <iostream>
using namespace std;
if (n == 0)
return temp;
int main()
{
int n;
cout << "enter number: " << endl;
cin >> n;