Take a double or float value X between 0 and 1 as a starting value. Generate a new value for X by the equation: X = 2 * X * (1 - X); Display X. Write a program that asks the user for a starting value X, then perform the above process in loop that runs through 50 cycles, while display the value of X.

Read my question. I HAVE DONE THIS ALREADY. This seems pretty easy to do. But after I did everything correctly, I got the very strange result.

The result I got is:

X = 1.xxxxxxxxxxxxxxxx + Exxx;

X = -infinity.

I got all the minus(- infinity) infinity result. I hope you guys could do this thing and run this code and tell me what the result you guys got.

Console.Write("enter a number: "); int X = int.Parse(Console.ReadLine()); for(int i = 1; i <= 50; i++) { X = 2 * X * (1 - X); Console.Write(X); }

This post has been edited by **kenryuakuma**: 05 November 2009 - 04:48 PM