luc026.c (973B)
1 /* 2 * Author: Amit Dutta (amitdutta4255@gmail.com) | Date: 12 Dec 2025 3 * Repo: https://github.com/notamitgamer/bsc 4 * License: MIT 5 */ 6 7 /* Write a program to recieve value of an angle in degreesand check 8 whether sum of squares of sine and cosine of this angle is equal to 1. */ 9 /* Let Us C, Chap- 4, Page - 73, Qn No.: E(d) */ 10 11 #include <stdio.h> 12 #include <math.h> 13 #define EPSILON 0.0000001 14 15 int main() 16 { 17 double angle, result; 18 printf("Enter the angle value in degree : "); 19 // checking if the input is other than number. 20 if(scanf("%lf", &angle) != 1) { 21 printf("\nPlease enter a number."); 22 return 1; 23 } 24 angle = angle * (M_PI / 180); // converting degree to radian 25 result = pow(sin(angle), 2) + pow(cos(angle), 2); 26 (fabs(result - 1.0) < EPSILON) ? 27 printf("\nsum of squares of sine and cosine of this angle is equal to 1.") : 28 printf("\nsum of squares of sine and cosine of this angle is NOT equal to 1."); 29 return 0; 30 }