asin() function

Given that the argument is in the range [-1, 1], the asin() function returns the value in the range of [-π/2, π/2].

Example 1: In radians

Input:  value = 0.30
Output: 0.304693

Example 2: In degrees

Input:  value = 0.30
Output: 17.4665

Approach 1: In radians

C++

#include <bits/stdc++.h>
using namespace std;

int main()

{
    double value = 0.30;

    cout << asin(value);

    return 0;
}

Approach 2: In degrees

C++

#include <bits/stdc++.h>
using namespace std;

int main()

{
    double value = 0.30;

    double radian = asin(value);

    double degrees = radian * 180 / 3.14;
    cout << degrees;

    return 0;
}


No comments:

Post a Comment