Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import javax.swing.*;
- public class LotteryOdds{
- public static void main(String args[]){
- String sNumbers = JOptionPane.showInputDialog("Enter in the amount of possible numbers: \n");
- int iNumbers = Integer.parseInt(sNumbers);
- String sBalls = JOptionPane.showInputDialog("Enter in the amount of balls taken: \n");
- int iBalls = Integer.parseInt(sBalls);
- int iFactorialA = 1;
- int iFactorialB = 1;
- int iTest = 0;
- int iFact = 1;
- int iTotal = 1;
- int iCount = 0;
- int iCountA = iBalls;
- do{
- int iNumber = iNumbers;
- iTotal = iNumbers * (iNumber -1);
- iNumbers--;
- iCountA--;
- }while(iCountA > 0);
- System.out.println("The circumference is: " + iTotal + " ");
- /*for(int iCount = iBalls; iCount > 1; iCount-- && iNumbers--){
- iTest = iNumbers;
- iFactorialA = (iNumbers - iCount);
- iFact = (iTest * iFactorialA);
- }
- */
- for(iCount = iBalls; iCount > 1 ; iCount--){
- iFactorialB *= iCount;
- }
- System.out.println("The circumference is: " + iFactorialB + " ");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement