Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- wart ich schicks dir gleich ma
- meine Lösung: die Falsch ist
- // TODO code application logic here
- double LnDrittel = 0;
- double vorzeichen = -1;
- double zaehler = 1;
- double nenner = 1;
- double bruch = 0;
- double ergebnis = 0;
- for (int i = 1; i <= 1000; i++){
- nenner = i;
- vorzeichen *= -1;
- bruch = (zaehler/nenner)* vorzeichen;
- LnDrittel = LnDrittel += bruch;
- }
- System.out.println("Ln(3) = " + LnDrittel);
- richtige Lösung:
- double vorzeichen = -1;
- double LnDrittel = 0;
- double zaehler = 1;
- double nenner = 1;
- double bruch = 0;
- for (int i = 1; i < 1000000000; i++){
- nenner+= nenner;
- vorzeichen *= (-1);
- bruch = vorzeichen *(1-zaehler/nenner);
- LnDrittel+= bruch;
- }
- System.out.println("Ln(3) = " + LnDrittel);
Add Comment
Please, Sign In to add comment