Advertisement
Guest User

Untitled

a guest
Apr 6th, 2020
156
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.89 KB | None | 0 0
  1.         int ileWyrazow = 16;
  2.         double wartoscX = 1.3;
  3.         double wartoscLogarytmu = 0;
  4.         double wartoscJednegoElementu = 0;
  5.  
  6.         for (int i = 1; i < ileWyrazow; i++) {
  7.  
  8.                 if(i%2==1){
  9.                     wartoscJednegoElementu = Math.pow((wartoscX - 1), i); // Math.pow(2,5)
  10.                     wartoscJednegoElementu = wartoscJednegoElementu / i;
  11.                     wartoscLogarytmu = wartoscLogarytmu + wartoscJednegoElementu;
  12.                 }
  13.                 if (i%2==0){
  14.                     wartoscJednegoElementu = Math.pow((wartoscX - 1), i);
  15.                     wartoscJednegoElementu = wartoscJednegoElementu / i;
  16.                     wartoscLogarytmu = wartoscLogarytmu - wartoscJednegoElementu;
  17.                 }
  18.             }
  19.        
  20.  
  21.             System.out.println("WARTOSC LOGARYTMU NATURALNEGO Z :" + wartoscX + " WYNOSI : " + wartoscLogarytmu);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement