Here's a C program to generate Trigonometric Table using For loop. This program also uses Math.h header file for using functions like sin(), cos() and tan().
# include <stdio.h> # include <conio.h> # include <math.h> void main() { float r ; int i ; char ch ; clrscr() ; printf("- - - - - - - - - - - - - - - - - -") ; printf("\nAngle \t Sin \t Cos \t Tan \n") ; printf("- - - - - - - - - - - - - - - - - -") ; for(i = 0 ; i <= 180 ; i = i + 30) { r = i * 3.14159 / 180 ; printf("\n%3d \t %5.2f \t %5.2f \t %5.2f\n", i, sin(r), cos(r), tan(r)); } printf("- - - - - - - - - - - - - - - - - -") ; getch() ; }
Output of above program is
- - - - - - - - - - - - - - - - - -
Angle Sin Cos Tan
- - - - - - - - - - - - - - - - - -
0 0.00 1.00 0.00
30 0.50 0.87 0.58
60 0.87 0.50 1.73
90 1.00 0.00 788898.12
120 0.87 -0.50 -1.73
150 0.50 -0.87 -0.58
180 0.00 -1.00 -0.00
- - - - - - - - - - - - - - - - - -
Explanation of above program
The program is very simple. Here we're calculating the values at different angles by using built-in C trigonometry functions like sin(), cos() and tan() which are available in math.h header file. Then using a for loop we're calculating values of sine, cos and tan at different angles and each angle is 30 degree apart, starting from 0 degree to 180 degree.
Inside the for loop first we're converting the angle in radian and then this value is passed in the functions sin(), cos() and tan().
Thanks for sharing such a nice program which generate a trigonometric table,in my opinion I think math's requires more practice than other subject so one should try to solve math’s problem very well. It will make math interesting and joyful.
verifying trigonometric identities worksheet
Thanks for you reply.
grate
grate
OlĂ ,
The challenge however, is we don’t yet know how it will be used making to hard to assess their value proposition and consequently value.
We are a technology company in South Africa with a few power electronic products containing micros with custom written software in C. We are trying now as non software engineers, with basic understanding of C to try and understand or interpret our software into basic english if I may put it that way. We are the hardware engineers and designed the unit but did not write the software ourselves.
if I posted sections of code, would someone be able to translate this for us and also write new improved modifications that we require
But nice Article Mate! Great Information! Keep up the good work!
Many Thanks,
cool, thanks!
There are error in this program...on tan90 ...it should be infinity instead of 788898.2