SHOW:
|
|
- or go back to the newest paste.
1 | import javax.swing.*; | |
2 | ||
3 | ||
4 | public class LotteryOdds{ | |
5 | public static void main(String args[]){ | |
6 | String sNumbers = JOptionPane.showInputDialog("Enter in the amount of possible numbers: \n"); | |
7 | int iNumbers = Integer.parseInt(sNumbers); | |
8 | String sBalls = JOptionPane.showInputDialog("Enter in the amount of balls taken: \n"); | |
9 | int iBalls = Integer.parseInt(sBalls); | |
10 | int iFactorialA = 1; | |
11 | int iFactorialB = 1; | |
12 | int iTest = 0; | |
13 | int iFact = 1; | |
14 | int iTotal = 1; | |
15 | int iCount = 0; | |
16 | int iCountA = iBalls; | |
17 | ||
18 | ||
19 | ||
20 | do{ | |
21 | int iNumber = iNumbers; | |
22 | iTotal = iNumbers * (iNumber -1); | |
23 | iNumbers--; | |
24 | iCountA--; | |
25 | }while(iCountA > 0); | |
26 | ||
27 | System.out.println("The circumference is: " + iTotal + " "); | |
28 | ||
29 | /*for(int iCount = iBalls; iCount > 1; iCount-- && iNumbers--){ | |
30 | iTest = iNumbers; | |
31 | iFactorialA = (iNumbers - iCount); | |
32 | iFact = (iTest * iFactorialA); | |
33 | } | |
34 | */ | |
35 | for(iCount = iBalls; iCount > 1 ; iCount--){ | |
36 | iFactorialB *= iCount; | |
37 | } | |
38 | ||
39 | System.out.println("The circumference is: " + iFactorialB + " "); | |
40 | ||
41 | - | //JOptionPane.showMessageDialog(null, |
41 | + | |
42 | - | // iTotal+ " " + iFactorialB, |
42 | + |