Monday 16 March 2015

Program to generate Trigonometric Table Using C

# 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() ;
}

RUN 1 :
~~~~~~~
- - - - - - - - - - - - - - - - - -
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
- - - - - - - - - - - - - - - - - -

No comments:

Post a Comment