/*
Save this in a file named iterates.c
on a UNIX machine (the NeXTs).  Compile this by entering the directory where the file is saved, then typing:
	cc -O -o iterate iterates.c


type "iterate" to execute.  When it works say "Thank you" to Britt!
*/

#include <stdio.h>

void main(void)
{
	int iterations,i,tail;
	float mu;
	double x;
	char theChar;

	theChar = 'Y';
	while((theChar != 'n')&&(theChar != 'N'))
	{
		printf ("mu: ");
		scanf("%f",&mu); getchar();
		printf("Iterations: ");
		scanf("%d",&iterations); getchar();
		printf ("x value: ");
		scanf("%f",&x); getchar();
		printf ("Tail: ");
		scanf("%d",&tail); getchar();
		for(i=1;i<=iterations;i++)
		{
			x = mu*x*(1 - x);
			if(i>=iterations-tail)
				printf("%g\n",x);
		}
		printf("Again? (y/n): ");
		scanf("%s",&theChar);
	}
}