This week only. Pastebin PRO Accounts Christmas Special! Don't miss out!Want more features on Pastebin? Sign Up, it's FREE!
Guest

FullCoding

By: a guest on Dec 16th, 2012  |  syntax: Java  |  size: 1.04 KB  |  views: 12  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
This paste has a previous version, view the difference. Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  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.                 }
  42.         }
clone this paste RAW Paste Data