[ create a new paste ] login | about

Link: http://codepad.org/Fw2J4wrU    [ raw code | output | fork ]

C++, pasted on Feb 5:
#include <iostream>

using namespace std;

int cmmdc(int a, int b)
{
	if ( (!a) || (!b) ) return a+b;
	if ( a>b ) return cmmdc(a%b, b);
	return cmmdc(a, b%a);
}

int main()
{
        unsigned long int t1=1, t2=1, t3, i, m=150;
        for (i=1; i<=m; i++) {
            t3 = t1 + t2;
            t1 = t2;
            t2 = t3;
        }
        unsigned long int t4=1, t5=1, t6, n=164;
        for (i=1; i<=n; i++) {
            t6 = t4 + t5;
            t4 = t5;
            t5 = t6;
        }

	int x=t3;
	int y=t6;

	cout << cmmdc(x, y);

	return 0;
}


Output:
1
7


Create a new paste based on this one


Comments: