Convert gradian to radian

Here given code implementation process.

//C Program 
//Convert gradian to radian
#include <stdio.h>

#include <math.h>

//Find the radian of given gradian
void gradian_to_radian(double gradian)
{
	// Formula : (gradian*π)/200
	// Calculate given gradian to radian 
	double radian = (gradian * M_PI) / 200;
	//Display result
	printf("Gradian : %lf  radian : %lf\n", gradian, radian);
}
int main()
{
	//Simple test
	gradian_to_radian(1);
	gradian_to_radian(50.80);
	gradian_to_radian(70.50);
	return 0;
}

Output

Gradian : 1.000000  radian : 0.015708
Gradian : 50.800000  radian : 0.797965
Gradian : 70.500000  radian : 1.107411
/*
  Java program
  Convert gradian to radian 
*/
class MyMath
{
	//Find the radian of given gradian
	public void gradian_to_radian(double gradian)
	{
		// Formula : (gradian*π)/200
		// Calculate given gradian to radian 
		double radian = (gradian * Math.PI) / 200;
		System.out.print("Gradian : " + gradian + " radian : " + radian + "\n");
	}
	public static void main(String[] args)
	{
		MyMath obj = new MyMath();
		//Simple test
		obj.gradian_to_radian(1);
		obj.gradian_to_radian(50.80);
		obj.gradian_to_radian(70.50);
	}
}

Output

Gradian : 1.0 radian : 0.015707963267948967
Gradian : 50.8 radian : 0.7979645340118074
Gradian : 70.5 radian : 1.107411410390402
/*
  C++ program
  Convert gradian to radian 
*/
#include<iostream>
#include<math.h>
using namespace std;
class MyMath
{
	public:
		//Find the radian of given gradian
		void gradian_to_radian(double gradian)
		{
			// Formula : (gradian*π)/200
			// Calculate given gradian to radian 
			double radian = (gradian * M_PI) / 200;
			cout << "Gradian : " << gradian << " radian : " << radian << "\n";
		}
};
int main()
{
	MyMath obj = MyMath();
	//Simple test
	obj.gradian_to_radian(1);
	obj.gradian_to_radian(50.80);
	obj.gradian_to_radian(70.50);
	return 0;
}

Output

Gradian : 1 radian : 0.015708
Gradian : 50.8 radian : 0.797965
Gradian : 70.5 radian : 1.10741
/*
  C# program
  Convert gradian to radian 
*/
using System;
class MyMath
{
	//Find the radian of given gradian
	public void gradian_to_radian(double gradian)
	{
		// Formula : (gradian*π)/200
		// Calculate given gradian to radian 
		double radian = (gradian * Math.PI) / 200;
		Console.Write("Gradian : " + gradian + " radian : " + radian + "\n");
	}
	public static void Main(String[] args)
	{
		MyMath obj = new MyMath();
		//Simple test
		obj.gradian_to_radian(1);
		obj.gradian_to_radian(50.80);
		obj.gradian_to_radian(70.50);
	}
}

Output

Gradian : 1 radian : 0.015707963267949
Gradian : 50.8 radian : 0.797964534011807
Gradian : 70.5 radian : 1.1074114103904
<?php
/*
  Php program
  Convert gradian to radian 
*/
class MyMath
{
	//Find the radian of given gradian
	public	function gradian_to_radian($gradian)
	{
		// Formula : (gradian*π)/200
		// Calculate given gradian to radian 
		$radian = ($gradian * M_PI) / 200;
		echo "Gradian : ". $gradian ." radian : ". $radian ."\n";
	}
}

function main()
{
	$obj = new MyMath();
	//Simple test
	$obj->gradian_to_radian(1);
	$obj->gradian_to_radian(50.80);
	$obj->gradian_to_radian(70.50);
}
main();

Output

Gradian : 1 radian : 0.015707963267949
Gradian : 50.8 radian : 0.79796453401181
Gradian : 70.5 radian : 1.1074114103904
/*
  Node Js program
  Convert gradian to radian 
*/
class MyMath
{
	//Find the radian of given gradian
	gradian_to_radian(gradian)
	{
		// Formula : (gradian*π)/200
		// Calculate given gradian to radian 
		var radian = (gradian * Math.PI) / 200;
		process.stdout.write("Gradian : " + gradian + " radian : " + radian + "\n");
	}
}

function main()
{
	var obj = new MyMath();
	//Simple test
	obj.gradian_to_radian(1);
	obj.gradian_to_radian(50.80);
	obj.gradian_to_radian(70.50);
}
main();

Output

Gradian : 1 radian : 0.015707963267948967
Gradian : 50.8 radian : 0.7979645340118074
Gradian : 70.5 radian : 1.107411410390402
#   Python 3 program
#   Convert gradian to radian 
import math
class MyMath :
	# Find the radian of given gradian
	def gradian_to_radian(self, gradian) :
		#  Formula : (gradian*π)/200
		#  Calculate given gradian to radian 
		radian = (gradian * math.pi) / 200
		print("Gradian : ", gradian ," radian : ", radian ,"\n", end = "")
	

def main() :
	obj = MyMath()
	# Simple test
	obj.gradian_to_radian(1)
	obj.gradian_to_radian(50.80)
	obj.gradian_to_radian(70.50)

if __name__ == "__main__": main()

Output

Gradian :  1  radian :  0.015707963267948967
Gradian :  50.8  radian :  0.7979645340118074
Gradian :  70.5  radian :  1.107411410390402
#   Ruby program
#   Convert gradian to radian 

class MyMath

	# Find the radian of given gradian
	def gradian_to_radian(gradian)
	
		#  Formula : (gradian*π)/200
		#  Calculate given gradian to radian 
		radian = (gradian * Math::PI) / 200
		print("Gradian : ", gradian ," radian : ", radian ,"\n")
	end
end
def main()

	obj = MyMath.new()
	# Simple test
	obj.gradian_to_radian(1)
	obj.gradian_to_radian(50.80)
	obj.gradian_to_radian(70.50)
end
main()

Output

Gradian : 1 radian : 0.015707963267948967
Gradian : 50.8 radian : 0.7979645340118074
Gradian : 70.5 radian : 1.107411410390402
/*
  Scala program
  Convert gradian to radian 
*/
class MyMath
{
	//Find the radian of given gradian
	def gradian_to_radian(gradian: Double): Unit = {
		// Formula : (gradian*π)/200
		// Calculate given gradian to radian 
		var radian: Double = (gradian * Math.PI) / 200;
		print("Gradian : " + gradian + " radian : " + radian + "\n");
	}
}
object Main
{
	def main(args: Array[String]): Unit = {
		var obj: MyMath = new MyMath();
		//Simple test
		obj.gradian_to_radian(1);
		obj.gradian_to_radian(50.80);
		obj.gradian_to_radian(70.50);
	}
}

Output

Gradian : 1.0 radian : 0.015707963267948967
Gradian : 50.8 radian : 0.7979645340118074
Gradian : 70.5 radian : 1.107411410390402
/*
  Swift program
  Convert gradian to radian 
*/
import Foundation
class MyMath
{
	//Find the radian of given gradian
	func gradian_to_radian(_ gradian: Double)
	{
		// Formula : (gradian*π)/200
		// Calculate given gradian to radian 
		let radian: Double = (gradian * Double.pi) / 200;
		print("Gradian : ", gradian ," radian : ", radian ,"\n", terminator: "");
	}
}
func main()
{
	let obj: MyMath = MyMath();
	//Simple test
	obj.gradian_to_radian(1);
	obj.gradian_to_radian(50.80);
	obj.gradian_to_radian(70.50);
}
main();

Output

Gradian :  1.0  radian :  0.015707963267949
Gradian :  50.8  radian :  0.797964534011807
Gradian :  70.5  radian :  1.1074114103904


Please share your knowledge to improve code and content standard. Also submit your doubts, and test case. We improve by your feedback. We will try to resolve your query as soon as possible.

New Comment







© 2021, kalkicode.com, All rights reserved