Lets write a C program to convert angle from Degree to Radian.
Formula To Convert Degree To Radian
radian = degree x (M_PI / 180.0);
where M_PI is a constant present in header file / library file math.h and its approximately equal to 3.14;
Note: Trigonometric Ratios like Sin, Cos, Tan etc take radian value as input and not degrees. So its important to learn how to convert angles from degree to radian.
radian = degree x ( PI / 180.0) where PI is 3.14159265359
Note: In C programming Language, we’ve a builtin constant M_PI which has value of PI.
Expected Output for the Input
User Input: Enter angle in Degree 45
Output: Sum of square of sin(45.00) and cos(45.00) is 1
Logic To Check If Sum of Square of Sine and Cosine of an Angle is 1
User enters the angle in degree. We convert angle from degree to radian. radian = degree x ( PI / 180.0) Next we use pow() method present in math.h library to sqaure the values of sin(angle) and cos(angle). We add the square of sin(angle) and cos(angle) and store it inside the variable sum, and display appropriate message to the user.
Video Tutorial: C Program To Check If Sum of Square of Sine and Cosine of an Angle is 1
Write a C program to receive Polar co-ordinates(r, θ) and convert them into Cartesian co-ordinates(x, y). Ask the user to enter theta(θ) value in degrees.