/* 3x+1 computation */
#include <stdio.h>

main()
     /* effect: print lines with values of
	T^(i)(7), until T^(i)(7) is 1 */
{
  extern int T(int);
  int x = 7;

  x = 7;
  do {
    printf("%d\n", x);
  } while ( (x = T(x)) > 1 );
}

int T(int n)
{
  if ((n % 2) == 0)
    n = n / 2;
  else
    n = (3*n + 1) / 2;
  return n;
}
