Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Mar 27th, 2013  |  syntax: Java  |  size: 0.75 KB  |  views: 24  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. /* Devoir de Java:
  2.  * Calcul de factoriel 100, et 2^100
  3.  * Réalisé par : KENFAOUI ILIASS
  4.  */
  5.  
  6. import java.math.*;
  7.  
  8. public class BigIn
  9. {
  10.         public static void main (String [] args)
  11.         {
  12.                 System.out.println("\n-------------------------");
  13.                 System.out.println("Calcul de 100 factoriel :");
  14.                 System.out.println("-------------------------");
  15.                 BigInteger A = BigInteger.valueOf(1);
  16.                 for(int i = 2; i<=100; i++)
  17.                         A = A.multiply(BigInteger.valueOf(i));
  18.                 System.out.println("100! = " + A.toString()+"\n");
  19.                 System.out.println("\n----------------");
  20.                 System.out.println("Calcul de 2^100 :");
  21.                 System.out.println("----------------");
  22.         BigInteger B = BigInteger.valueOf(2).pow(100);
  23.                 System.out.println("2^100 = " + B.toString());
  24.     }
  25. }
clone this paste RAW Paste Data