Nilai Sudut Sin , Cos , Tan

04.04 jalankaki 2 Comments

TRIGONOMETRI
Monggo ini Source Code Trigonometri :

#include <stdio.h>
#include <math.h>
#define pi 3.14159
double radian(double);

double radian(double x)
{
double rad;
rad=x/180.0f*pi;
return(rad);
}

main()
{
int i;
double x[13],rad[13],xsin[13][3],xcos[13][3],xtan[13][3];

for(i=0;i<13;i++)
{
if(i==0)
x[i]=0;
else
x[i]=x[i-1]+30;
rad[i]=radian(x[i]);
xsin[i][0]=sin(rad[i]);
xcos[i][1]=cos(rad[i]);
xtan[i][2]=tan(rad[i]);
}
printf(" ---------------------------------------------------------------");
printf("|\tX\t|\tSin(x)\t|\tCos(x)\t|\tTan(x)\t|\n");
printf(" ---------------------------------------------------------------");
for(i=0;i<13;i++)
{
printf("|\t%.0lf\t",x[i]);
printf("|\t%.2lf\t",xsin[i][0]);
printf("|\t%.2lf\t",xcos[i][1]);
if (xtan[i][2]>5)
printf("|\t%.0lf\t|\n",xtan[i][2]);
else
printf("|\t%.2lf\t|\n",xtan[i][2]);
printf(" ---------------------------------------------------------------");
}
printf("\n");
}

Ini hasil outputnya :


You Might Also Like

2 komentar:

  1. ini web kok sepi ica merinda... ayo mana nih pengunjung nya :D
    www.sayfudinblogz.blogspot.com

    BalasHapus