Advertisement
Guest User

4.4-6

a guest
Oct 15th, 2019
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.16 KB | None | 0 0
  1. package proj1;
  2.  
  3. import java.text.DecimalFormat;
  4.  
  5. public class P44_45_46
  6. {
  7. public static void main(String[] args)
  8. {
  9.  
  10. //4.4
  11. DecimalFormat df = new DecimalFormat();
  12. df.setMaximumFractionDigits(8);
  13. double chance = (6D/49D) * (5D/48D) * (4D/ 47D) * (3D/46D) * (2D/45D) * (1D/44D) ;
  14. System.out.println ("The chance of winning at 6/49 is : " + df.format(chance) + "%" +'\n');
  15.  
  16. //4.5
  17. // int max = 49;
  18. // int min = 1;
  19. // int range = max - min + 1;
  20. // int[] list = new int [6];
  21. //
  22. // for (int i = 0; i < 6; i++)
  23. // {
  24. // list[i] = (int)(Math.random() * range) + min;
  25. // }
  26. // for (int i = 0; i < 6; i++)
  27. // {
  28. // System.out.println(list[i] + '/n');
  29. // }
  30.  
  31. //4.6
  32. int max = 49;
  33. int min = 1;
  34. int range = max - min + 1;
  35. long pack ;
  36. for (int i = 0; i < 5; i++)
  37. {
  38. pack = ((long) (Math.random() * range) + min ) << 6 ;
  39. }
  40. pack = ((long) (Math.random() * range) + min );
  41. // pack poate ajunge la 36 de biti care e mai mare decat long ?????
  42. int nmin = 0 ;
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49. }
  50. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement