Program to Convert Radian to Degree in C

CServer Side ProgrammingProgramming

If input is in radian convert it to degree else input will be in radian convert it to degree. There are formulas that can be used for this conversion.

Radian is the standard unit for measuring angles whereas the complete angle of circle is divided into 360 degree. Also, radian is the smaller value as 1 degree = 180 radians.

Conversion Formulas −

degree = radian * (180/pi)
where, pi=3.14 or 22/7

Example

Input-: radian = 9.0
Output-: degree is : 515.92357

Algorithm

Start
Step 1 -> define macro as #define pi 3.14
Step 2 -> declare function for converting radian to degree
   double convert(double radian)
      return(radian * (180/pi))
Step 3 -> In main()
   Declare variable as double radian = 9.0
   Declare and set double degree = convert(radian)
   Print degree
Stop

Example

#include <stdio.h>
#define pi 3.14
// Function for converting radian to degree
double convert(double radian){
   return(radian * (180/pi));
}
   int main(){
   double radian = 9.0;
   double degree = convert(radian);
   printf("degree is : %.5lf", degree);
   return 0;
}

Output

degree is : 515.92357
raja
Updated on 23-Sep-2019 10:58:09

Advertisements