Chapter - 2: C Instructions

Write a program to receive values of an angle in degrees and check whether sum of squares sin and cosine of this angle is equal to 1.


H
Sections
8
Exercises
#include<stdio.h>
#include<conio.h>
#include<math.h>
int main()
{
    float ang;
    
    printf("\nEnter the angle in degree : ");
    scanf("%f", &ang);
    
    //Converting degree into radian
    ang = ang*((22.0/7.0)/180.0);
    
    sum = cos(ang) + sin(ang);
    
    if(sum == 1)
        printf("\nTheir sum is one.");
    else
        printf("\nTheir sum is not one");
    
    printf("%f", ang);
    return 0;
}

© 2021 Garbage Valuegarbage value logo