daily pastebin goal
29%
SHARE
TWEET

Untitled

a guest Jan 21st, 2018 50 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import javax.swing.JOptionPane;
  2. public class t36noppa {
  3.     public static void main(String[] args) {
  4.         int kertaa;
  5.         String str="", print="";
  6.         str=JOptionPane.showInputDialog("Monta kertaa heitetään?");
  7.         kertaa = Integer.parseInt(str);
  8.         int[] noppa = new int [kertaa];
  9.         int[] monta = new int [kertaa];
  10.         for(int i=0;i<kertaa;i++){
  11.             noppa[i]=(1 + (int)(Math.random() * 6))+(1 + (int)(Math.random() * 6));
  12.         } // end of for
  13.         for(int j=0;j<kertaa;j++){
  14.             for(int k=2;k<13;k++){
  15.                 if(noppa[j]==k) {
  16.                     ++monta[k]; }
  17.             }
  18.         }
  19.         for(int x=2;x<13;x++) {
  20.         print += x+". "+monta[x]+" \n";
  21.         }
  22.         JOptionPane.showMessageDialog(null, print);
  23.     } // end of class
  24. } // end of main
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top