Convert gradian to degree

Here given code implementation process.

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

#include <math.h>

//Find the degree of given gradian
void gradian_to_degree(double gradian)
{
	// Formula : (gradian*180)/200
	// Calculate given gradian to degree 
	double degree = (gradian * 180) / 200;
	//Display result
	printf("Gradian : %lf  Degree : %lf\n", gradian, degree);
}
int main()
{
	//Simple test
	gradian_to_degree(1);
	gradian_to_degree(70.8);
	gradian_to_degree(1000.5);
	return 0;
}

Output

Gradian : 1.000000  Degree : 0.900000
Gradian : 70.800000  Degree : 63.720000
Gradian : 1000.500000  Degree : 900.450000
/*
  Java program
  Convert gradian to degree 
*/
class MyMath
{
	//Find the degree of given gradian
	public void gradian_to_degree(double gradian)
	{
		// Formula : (gradian*180)/200
		// Calculate given gradian to degree 
		double degree = (gradian * 180) / 200;
		System.out.print("Gradian : " + gradian + " Degree : " + degree + "\n");
	}
	public static void main(String[] args)
	{
		MyMath obj = new MyMath();
		//Simple test
		obj.gradian_to_degree(1);
		obj.gradian_to_degree(70.80);
		obj.gradian_to_degree(1000.50);
	}
}

Output

Gradian : 1.0 Degree : 0.9
Gradian : 70.8 Degree : 63.72
Gradian : 1000.5 Degree : 900.45
/*
  C++ program
  Convert gradian to degree 
*/
#include<iostream>

using namespace std;
class MyMath
{
	public:
		//Find the degree of given gradian
		void gradian_to_degree(double gradian)
		{
			// Formula : (gradian*180)/200
			// Calculate given gradian to degree 
			double degree = (gradian * 180) / 200;
			cout << "Gradian : " << gradian << " Degree : " << degree << "\n";
		}
};
int main()
{
	MyMath obj = MyMath();
	//Simple test
	obj.gradian_to_degree(1);
	obj.gradian_to_degree(70.80);
	obj.gradian_to_degree(1000.50);
	return 0;
}

Output

Gradian : 1 Degree : 0.9
Gradian : 70.8 Degree : 63.72
Gradian : 1000.5 Degree : 900.45
/*
  C# program
  Convert gradian to degree 
*/
using System;
class MyMath
{
	//Find the degree of given gradian
	public void gradian_to_degree(double gradian)
	{
		// Formula : (gradian*180)/200
		// Calculate given gradian to degree 
		double degree = (gradian * 180) / 200;
		Console.Write("Gradian : " + gradian + " Degree : " + degree + "\n");
	}
	public static void Main(String[] args)
	{
		MyMath obj = new MyMath();
		//Simple test
		obj.gradian_to_degree(1);
		obj.gradian_to_degree(70.80);
		obj.gradian_to_degree(1000.50);
	}
}

Output

Gradian : 1 Degree : 0.9
Gradian : 70.8 Degree : 63.72
Gradian : 1000.5 Degree : 900.45
<?php
/*
  Php program
  Convert gradian to degree 
*/
class MyMath
{
	//Find the degree of given gradian
	public	function gradian_to_degree($gradian)
	{
		// Formula : (gradian*180)/200
		// Calculate given gradian to degree 
		$degree = ($gradian * 180) / 200;
		echo "Gradian : ". $gradian ." Degree : ". $degree ."\n";
	}
}

function main()
{
	$obj = new MyMath();
	//Simple test
	$obj->gradian_to_degree(1);
	$obj->gradian_to_degree(70.80);
	$obj->gradian_to_degree(1000.50);
}
main();

Output

Gradian : 1 Degree : 0.9
Gradian : 70.8 Degree : 63.72
Gradian : 1000.5 Degree : 900.45
/*
  Node Js program
  Convert gradian to degree 
*/
class MyMath
{
	//Find the degree of given gradian
	gradian_to_degree(gradian)
	{
		// Formula : (gradian*180)/200
		// Calculate given gradian to degree 
		var degree = (gradian * 180) / 200;
		process.stdout.write("Gradian : " + gradian + " Degree : " + degree + "\n");
	}
}

function main()
{
	var obj = new MyMath();
	//Simple test
	obj.gradian_to_degree(1);
	obj.gradian_to_degree(70.80);
	obj.gradian_to_degree(1000.50);
}
main();

Output

Gradian : 1 Degree : 0.9
Gradian : 70.8 Degree : 63.72
Gradian : 1000.5 Degree : 900.45
#   Python 3 program
#   Convert gradian to degree 

class MyMath :
	# Find the degree of given gradian
	def gradian_to_degree(self, gradian) :
		#  Formula : (gradian*180)/200
		#  Calculate given gradian to degree 
		degree = (gradian * 180) / 200
		print("Gradian : ", gradian ," Degree : ", degree ,"\n", end = "")
	

def main() :
	obj = MyMath()
	# Simple test
	obj.gradian_to_degree(1)
	obj.gradian_to_degree(70.80)
	obj.gradian_to_degree(1000.50)

if __name__ == "__main__": main()

Output

Gradian :  1  Degree :  0.9
Gradian :  70.8  Degree :  63.72
Gradian :  1000.5  Degree :  900.45
#   Ruby program
#   Convert gradian to degree 

class MyMath

	# Find the degree of given gradian
	def gradian_to_degree(gradian)
	
		#  Formula : (gradian*180)/200
		#  Calculate given gradian to degree 
		degree = (gradian * 180) / 200
		print("Gradian : ", gradian ," Degree : ", degree ,"\n")
	end
end
def main()

	obj = MyMath.new()
	# Simple test
	obj.gradian_to_degree(1)
	obj.gradian_to_degree(70.80)
	obj.gradian_to_degree(1000.50)
end
main()

Output

Gradian : 1 Degree : 0
Gradian : 70.8 Degree : 63.72
Gradian : 1000.5 Degree : 900.45
/*
  Scala program
  Convert gradian to degree 
*/
class MyMath
{
	//Find the degree of given gradian
	def gradian_to_degree(gradian: Double): Unit = {
		// Formula : (gradian*180)/200
		// Calculate given gradian to degree 
		var degree: Double = (gradian * 180) / 200;
		print("Gradian : " + gradian + " Degree : " + degree + "\n");
	}
}
object Main
{
	def main(args: Array[String]): Unit = {
		var obj: MyMath = new MyMath();
		//Simple test
		obj.gradian_to_degree(1);
		obj.gradian_to_degree(70.80);
		obj.gradian_to_degree(1000.50);
	}
}

Output

Gradian : 1.0 Degree : 0.9
Gradian : 70.8 Degree : 63.72
Gradian : 1000.5 Degree : 900.45
/*
  Swift program
  Convert gradian to degree 
*/
class MyMath
{
	//Find the degree of given gradian
	func gradian_to_degree(_ gradian: Double)
	{
		// Formula : (gradian*180)/200
		// Calculate given gradian to degree 
		let degree: Double = (gradian * 180) / 200;
		print("Gradian : ", gradian ," Degree : ", degree ,"\n", terminator: "");
	}
}
func main()
{
	let obj: MyMath = MyMath();
	//Simple test
	obj.gradian_to_degree(1);
	obj.gradian_to_degree(70.80);
	obj.gradian_to_degree(1000.50);
}
main();

Output

Gradian :  1.0  Degree :  0.9
Gradian :  70.8  Degree :  63.72
Gradian :  1000.5  Degree :  900.45


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