Sinuswerte, Java Code:
public class sin {
public static void main(String[] args) {
for ( int i = 0; i = 200; i++)
System.out.println( Math.PI / 100 * i + ": " + Math.sin( Math.PI / 100 * i ) );
}
}
Sinuswerte, php Code:
?php
for( $i; $i = 200; $i++ ){
echo( round( sin( pi() / 100 * $i ), 4 ).'br' );
}
?
Cosinuswerte, Java Code:
public class cos {
public static void main(String[] args) {
for ( int i = 0; i = 200; i++)
System.out.println( Math.PI / 100 * i + ": " + Math.cos( Math.PI / 100 * i ) );
}
}
Cosinuswerte, php Code:
?php
for( $i; $i = 200; $i++ ){
echo( round( cos( pi() / 100 * $i ), 4 ).'br' );
}
?
This entry was posted on Jul 07, 2006 at 10:37:03 and is filed under PHP & Java. You can follow any responses to this entry through the RSS 2.0 feed, or leave a response (below) .
Der nachfolgende Code stammt aus dem letzten Beispiel:
if($i ==(1/2)) echo cos (pi()* 1/2) ;
if ($i == (3/2)) echo cos (pi() * 3/2);
Kann es sein, dass bei dem Code noch zwei "pi()" fehlen, so dass der Code dann wie folgt aussehen würde?
if ($i == pi()*(1/2)) echo cos (pi()* 1/2) ;
if ($i == pi()*(3/2)) echo cos (pi() * 3/2);
Ja stimmt natürlich! Außerdem waren die Abrfagen für $i = 0 usw. auch gar nicht nötig. Habe also alles nochmal überarbeitet.
Kommentare sind für diesen Beitrag geschlossen.