bsc

Comprehensive codebase and cou...
Log | Files | Refs | Activity | README | LICENSE

root / semester_1 / letusc / luc026.c

luc026.c (837B)


      1 /* Write a program to recieve value of an angle in degreesand check
      2 whether sum of squares of sine and cosine of this angle is equal to 1. */
      3 /* Let Us C, Chap- 4, Page - 73, Qn No.: E(d) */
      4 
      5 #include <stdio.h>
      6 #include <math.h>
      7 #define EPSILON 0.0000001
      8 
      9 int main()
     10 {
     11     double angle, result;
     12     printf("Enter the angle value in degree : ");
     13     // checking if the input is other than number.
     14     if(scanf("%lf", &angle) != 1) {
     15         printf("\nPlease enter a number.");
     16         return 1;
     17     }
     18     angle = angle * (M_PI / 180); // converting degree to radian
     19     result = pow(sin(angle), 2) + pow(cos(angle), 2);
     20     (fabs(result - 1.0) < EPSILON) ?
     21     printf("\nsum of squares of sine and cosine of this angle is equal to 1.") :
     22     printf("\nsum of squares of sine and cosine of this angle is NOT equal to 1.");
     23     return 0;
     24 }
© notamitgamer • Site Built: 2026-09-05 01:53:16 UTC • git-mirror commit: c170d72 [view raw info]
Originally created with stagit • modified by notamitgamer
Forked from github.com/notamitgamer/git-mirror