Results 1 to 3 of 3
Thread: BigInteger value of
- 09-26-2010, 03:19 PM #1
Senior Member
- Join Date
- May 2010
- Posts
- 112
- Rep Power
- 0
BigInteger value of
I copied this code from a book on Eclipse but when I tried to run it there are red underlines under "valueOf".
Everything is fine except from these 3 terms "valueOf".I wonder if any body got a clue.This full code is below:=
Java Code:import java.math.*; import java.util.*; public class BigInteger { public static void main (String []args) { Scanner in = new Scanner(System.in); System.out.println("How many numbers do you need to draw ?"); int k = in.nextInt(); System.out.print("What is the highest number you can draw ?"); int n = in.nextInt(); BigInteger lotteryodds = BigInteger.valueOf(1); for(int i = 1; i <=k; i++) lotteryodds = lotteryodds .multiply(BigInteger.valueOf(n - i + 1)) .divide(BigInteger.valueOf(i)); System.out.println("Your odds are in 1 in "+ lotteryodds +".Good luck"); } }
- 09-26-2010, 03:25 PM #2
Senior Member
- Join Date
- May 2010
- Posts
- 112
- Rep Power
- 0
Resolved
I fixed the problem.
I was missing this line at the top
Java Code:import java.math.BigInteger;
- 09-26-2010, 03:46 PM #3
Member
- Join Date
- Sep 2010
- Posts
- 1
- Rep Power
- 0
Similar Threads
-
convert BigInteger
By bobo67 in forum New To JavaReplies: 1Last Post: 09-01-2010, 02:00 PM -
BigInteger
By windows.login in forum New To JavaReplies: 8Last Post: 07-13-2010, 01:10 PM -
very new... Biginteger problems
By willemien in forum New To JavaReplies: 6Last Post: 05-02-2010, 03:17 PM -
My own BigInteger class. Need help.
By Dinde in forum New To JavaReplies: 2Last Post: 01-27-2010, 08:49 PM -
how to convert from BigInteger to Hex
By nanaji in forum Advanced JavaReplies: 10Last Post: 05-22-2008, 12:44 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks