Search found 1 match

by intek
Sat Apr 14, 2007 8:26 am
Forum: Volume 1 (100-199)
Topic: 100 - The 3n + 1 problem
Replies: 1394
Views: 320024

100: restricted function (i'm new *SNIFF)

// http://acm.uva.es/p/v1/100.html

#include <iostream>
using namespace std;

int algorithm(int x)
{
int temp=x;
int count=0;

algorithm:
if(temp!=1)
{
// ODD***************************
if(temp%2) {
temp = (3*temp)+1;
count++;
goto algorithm;
}

// EVEN***************************
if ...

Go to advanced search