answersLogoWhite

0


Best Answer

<div id="trig"></div>

<script type="text/javascript">

function getTrigTable( minAngle, maxAngle, step) {

var angle, trigArr = [], resultsArr= [], deg2rad = Math.PI / 180.0, i, tableHTML = "";

minAngle = parseFloat( minAngle );

if (isNaN( minAngle )) minAngle = 0;

maxAngle = parseFloat( maxAngle );

if (isNaN( maxAngle ) maxAngle < minAngle) maxAngle = 360;

step = Math.abs(parseFloat( step ) 1);

for (angle = minAngle; angle <= maxAngle; angle += step) {

trigArr[0] = angle + "&deg;";

trigArr[1] = Math.round(Math.sin( angle * deg2rad ) * 1e7) / 1e7;

trigArr[2] = Math.round(Math.cos( angle * deg2rad ) * 1e7) / 1e7;

trigArr[3] = Math.round(Math.tan( angle * deg2rad ) * 1e7) / 1e7;

if (trigArr[2] == 0) trigArr[3] = "&infin;";

resultsArr.push( trigArr.slice() );

}

for (i = 0; i < resultsArr.length; i++) {

tableHTML += "<tr><td>" + resultsArr[ i ].join( "</td><td>" ) + "</td></tr>";

}

return "<table border="1"><thead>" +

"<tr><th>Angle</th><th>Sin</th><th>Cos</th><th>Tan</th></tr>" +

"</thead><tbody>" + tableHTML + "</tbody></table>";

}

window.onload = function() {

document.getElementById( "trig" ).innerHTML = getTrigTable();

}

</script>

User Avatar

Wiki User

15y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: How can you write a program that prints a table of trigonometric values for sin cos and tan?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

What does the trigonometric table do?

trigonometric table gives the values of all the trigonometric functions for any angle. i.e; it gives the numerical values of sine, cosine, tangent etc for any angle between 0 to 180 degrees the values for other angles can be calculated using these.


How can you write a c program that prints a table of trigonometric values for sin cos and tan?

#include&lt;stdio.h&gt; #include&lt;conio.h&gt; #include&lt;math.h&gt; void main() { const float pi=3.14; float angle,radian; clrscr(); printf("Angle\t Radian\t\t sin\t\t cos\t\t tangent"); for(angle=0;angle&lt;=180;angle+=10) { radian=(pi/180.0)*angle; printf("\n%0.0f\t%f\t%f\t%f\t%f",angle,radian,sin(radian),cos(radian),tan(radian)); } getch(); }


Dry run table in flow-chart?

/* my second program in C++ with more comments */ #include &lt;iostream&gt; using namespace std; int main () { cout &lt;&lt; "Hello World! "; // prints Hello World! cout &lt;&lt; "I'm a C++ program"; // prints I'm a C++ program return 0; }


Trigonometric table for decimal value of theta?

221 is theta (1)


Why trigonometric table are not zero?

PLEASE rephrase that. I don't speak broken


What components of the interpreter contains the values of the data items declared in the program being interpreted?

Symbol table


What mathematician created trigonometry?

Trigonometry goes back to ancient times. The first trigonometric table is attributed to Hipparchus of Nicaea.


Table of values?

NRRRGGH!


What is table of cosines?

It is a table that gives the cosines of angles, usually from 0 to 90 degrees in steps on 0.1 degree. These were used extensively for trigonometric calculations before the advent of computers.


What advantages can you see of having a function rule instead of a table of values?

A table of values is no use if the domain is infinite.


What is a table of values?

A table you make to find the coordinates to graph.


What is the definition of Table of value?

to have the values of x and y in a table