IHYPRESS PROGRAMMING
Tutorials and Perl programs with code and output for beginners
Perl logo
HOME | ASP | C | CSS | GNUPLOT | HTML | JAVASCRIPT | PERL | PHP | PYTHON | RUBY | SVG
Perl ❯ Trigonometric Functions
<16>
#!/usr/bin/perl -wT use CGI':standard'; use CGI::Carp qw(warningsToBrowser fatalsToBrowser); use Math::Trig; print header(); print start_html(-title => "Trigonometric Functions"); my $angle1 = 45; my $angle2 = 30; #conversion into radians with the predefined pi() from the Trig module my $rad1 = $angle1 * pi()/180; my $rad2 = $angle2 * pi()/180; print "<div style='color:#0000cc;font-size:1.3em;'>"; print "The sine of $angle1 degrees is " . sprintf (sin($rad1)) . "<br>"; print "The cosine of $angle1 degrees is " . sprintf (cos($rad1)) . "<br>"; print "The tangent of $angle1 degrees is " . sprintf (tan($rad1)) . "<br><br>"; print "The sine of $angle2 degrees is " . sprintf (sin($rad2)) . "<br>"; print "The cosine of $angle2 degrees is " . sprintf (cos($rad2)) . "<br>"; print "The tangent of $angle2 degrees is " . sprintf (tan($rad2)) . "<br>"; print "</div>"; print end_html();
Hergestellt in Deutschland / Made in Germany
Trigonometric Functions
The sine of 45 degrees is 0.707106781186547
The cosine of 45 degrees is 0.707106781186548
The tangent of 45 degrees is 1

The sine of 30 degrees is 0.5
The cosine of 30 degrees is 0.866025403784439
The tangent of 30 degrees is 0.577350269189626
COPYRIGHT © 2015-2024 IHY PRESS Frankfurt am Main 60329 Deutschland