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

A

B

C

D

E

F

G

H

1

2

3

4

5

6

7

8

9

10

#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;
}

© 2020 Garbage Valuegarbage value logo