/*Hasse-Collartz-Problem, Terminierung*/
/*16.5.2001*/

#include<stdio.h>
#include<math.h>
#include<conio.h>

void main()
{
  int x, rest;
  char nochmal;

  nochmal='j';
  while (nochmal=='j')
  {


    printf("Geben Sie eine Zahl ein: ");
    scanf("%d", &x);



    do
    {
      rest=x%2;

      if (rest==0)
      {
        x=x/2;
	     printf("\nif path ");
	     printf("%d", x);
      }

      else
      {
        x=3*x+1;
	     printf("\nelse path ");
	     printf("%d", x);
      }
    }
    while (x!=1);

    
    printf("\n%d", x);
    printf("\nnochmal? ");
    scanf("%s", &nochmal);
  }
   
}

