|
-
Calculation
[Originally posted by Vicky]
Hi... Can anyone help me....
The program that I'm writing now is simulating the Collatz Problem and determine the number of steps taken to reach 1 for any given intger.The process is that if the number is even, divide that number by 2; If the number is odd, multiply that number by 3 and then add 1. the calculation goes on and on until the number is 1
I got this problem:
If the input number is odd then multiply the number by 3 then add 1 to it.
I call the number intNu..
I've type intNu= (intNu*3)+1)
but when i run the program, a message pop up and says i got this overflow problem....
What should i do to make it work....
Thankyou
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks