Advertisement
Guest User

Untitled

a guest
Oct 25th, 2014
160
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.38 KB | None | 0 0
  1. public class Main {
  2.  
  3.  
  4.     public static void main(String[] args) {
  5.         int[] data = {
  6.             factorial(10)/10,
  7.             factorial(9)/10,
  8.             factorial(8)/10
  9.             // ...
  10.         };
  11.  
  12.         JOptionPane.showConfirmDialog(null, data[q]);
  13.     }
  14.  
  15.     public static int factorial(int n) {
  16.         int ret = 1;
  17.         for (int i = 1; i <= n; i++) {
  18.             ret *= i;
  19.         }
  20.         return ret;
  21.     }
  22.  
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement