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.
Related Read:
Keywords, Constants, Variables: C
Basic Arithmetic Operations In C
Print All Trigonometric Ratios: C Program
C Program To Convert Radian To Degree
Video Tutorial: C Program To Convert Degree To Radian
Source Code: C Program To Convert Degree To Radian
- #include<stdio.h>
- #include<math.h>
- int main()
- {
- float degree, radian;
- printf("Enter angle in Degrees\n");
- scanf("%f", °ree);
- radian = degree * ( M_PI / 180.0 );
- printf("Angle in Radian is %f\n", radian);
- return 0;
- }
Output 1:
Enter angle in Degrees
90
Angle in Radian is 1.570796
Output 2:
Enter angle in Degrees
360
Angle in Radian is 6.283185
For list of all c programming interviews / viva question and answers visit: C Programming Interview / Viva Q&A List
For full C programming language free video tutorial list visit:C Programming: Beginner To Advance To Expert