IHYPRESS.NET
PERL
HOME | ASP | C | CSS | HTML | JAVASCRIPT | PERL | PHP | PYTHON | RUBY | SVG
Earn Free Bitcoin
Perl ❯ Trigonometric Functions
<16>
#!/usr/bin/perl -wT use CGI ':standard'; use CGI::Carp qw(warningsToBrowser fatalsToBrowser); use strict; 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();
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 IHYPRESS.NET. A DIVISION OF IHY PRESS. ALL RIGHTS RESERVED.