bsc

Comprehensive codebase and coursework for the 4-year B.Sc. Computer Science Honours degree (WBSU)

git clone https://github.com/notamitgamer/bsc.git
· rebuilt hourlyOpen on GitHub
root / semester_1 / letusc / luc008.c

luc008.c (785B)


      1 /* If value of an angle is input through the keyboard,
      2 write a program to print all its trigonometric ratios. */
      3 /* Let Us C, Chap - 2, Page - 37, Qn No.: G(e) */
      4 
      5 #include <stdio.h>
      6 #include <math.h>
      7 int main()
      8 {
      9     double inp, rsin, rcos, rtan, rcosec, rsec, rcot;
     10     printf("Enter the Angle in degree : ");
     11     scanf("%lf", &inp);
     12     inp = inp * (M_PI / 180); //changing degree to radian
     13     rsin = sin(inp);
     14     rcos = cos(inp);
     15     rtan = tan(inp);
     16     rcosec = 1 / rsin;
     17     rsec = 1 / rcos;
     18     rcot = 1 / rtan;
     19     printf("\nTrigonometric ratios :-"
     20            "\nsin   = %g "
     21            "\ncos   = %g"
     22            "\ntan   = %g"
     23            "\ncosec = %g"
     24            "\nsec   = %g"
     25            "\ncot   = %g",
     26            rsin, rcos, rtan, rcosec, rsec, rcot);
     27     return 0;
     28 }