Convert the square metre to square yard

Here given code implementation process.

//C Program 
//Convert the square metre to square yard
#include <stdio.h>

//Find the square metre of given square yard
void square_metre_to_square_yard(double square_metre)
{
	// Formula : (Square Metre * 1.196)
	// Calculate square yard 
	double square_yard = (square_metre * 1.196);
	//Display result
	printf("Square Metre :  %lf  Square Yard : %lf\n", square_metre, square_yard);
}
int main()
{
	//Simple test
	square_metre_to_square_yard(1);
	square_metre_to_square_yard(12.7);
	square_metre_to_square_yard(21);
	return 0;
}

Output

Square Metre :  1.000000  Square Yard : 1.196000
Square Metre :  12.700000  Square Yard : 15.189200
Square Metre :  21.000000  Square Yard : 25.116000
/*
Java program
Convert the square metre to square yard
*/
class MyMath
{
	//Find the square metre of given square yard
	public void square_metre_to_square_yard(double square_metre)
	{
		// Formula : (Square Metre * 1.196)
		// Calculate square yard 
		double square_yard = (square_metre * 1.196);
		System.out.print("Square Metre : " + square_metre + " Square Yard : " + square_yard + "\n");
	}
	public static void main(String[] args)
	{
		MyMath obj = new MyMath();
		//Simple test
		obj.square_metre_to_square_yard(1);
		obj.square_metre_to_square_yard(12.7);
		obj.square_metre_to_square_yard(21);
	}
}

Output

Square Metre : 1.0 Square Yard : 1.196
Square Metre : 12.7 Square Yard : 15.189199999999998
Square Metre : 21.0 Square Yard : 25.116
/*
C++ program
Convert the square metre to square yard
*/
#include<iostream>

using namespace std;
class MyMath
{
	public:
		//Find the square metre of given square yard
		void square_metre_to_square_yard(double square_metre)
		{
			// Formula : (Square Metre * 1.196)
			// Calculate square yard 
			double square_yard = (square_metre * 1.196);
			cout << "Square Metre : " << square_metre << " Square Yard : " << square_yard << "\n";
		}
};
int main()
{
	MyMath obj ;
	//Simple test
	obj.square_metre_to_square_yard(1);
	obj.square_metre_to_square_yard(12.7);
	obj.square_metre_to_square_yard(21);
	return 0;
}

Output

Square Metre : 1 Square Yard : 1.196
Square Metre : 12.7 Square Yard : 15.1892
Square Metre : 21 Square Yard : 25.116
/*
C# program
Convert the square metre to square yard
*/
using System;
class MyMath
{
	//Find the square metre of given square yard
	public void square_metre_to_square_yard(double square_metre)
	{
		// Formula : (Square Metre * 1.196)
		// Calculate square yard 
		double square_yard = (square_metre * 1.196);
		Console.Write("Square Metre : " + square_metre + " Square Yard : " + square_yard + "\n");
	}
	public static void Main(String[] args)
	{
		MyMath obj = new MyMath();
		//Simple test
		obj.square_metre_to_square_yard(1);
		obj.square_metre_to_square_yard(12.7);
		obj.square_metre_to_square_yard(21);
	}
}

Output

Square Metre : 1 Square Yard : 1.196
Square Metre : 12.7 Square Yard : 15.1892
Square Metre : 21 Square Yard : 25.116
<?php
/*
Php program
Convert the square metre to square yard
*/
class MyMath
{
	//Find the square metre of given square yard
	public	function square_metre_to_square_yard($square_metre)
	{
		// Formula : (Square Metre * 1.196)
		// Calculate square yard 
		$square_yard = ($square_metre * 1.196);
		echo "Square Metre : ". $square_metre ." Square Yard : ". $square_yard ."\n";
	}
}

function main()
{
	$obj = new MyMath();
	//Simple test
	$obj->square_metre_to_square_yard(1);
	$obj->square_metre_to_square_yard(12.7);
	$obj->square_metre_to_square_yard(21);
}
main();

Output

Square Metre : 1 Square Yard : 1.196
Square Metre : 12.7 Square Yard : 15.1892
Square Metre : 21 Square Yard : 25.116
/*
Node Js program
Convert the square metre to square yard
*/
class MyMath
{
	//Find the square metre of given square yard
	square_metre_to_square_yard(square_metre)
	{
		// Formula : (Square Metre * 1.196)
		// Calculate square yard 
		var square_yard = (square_metre * 1.196);
		process.stdout.write("Square Metre : " + square_metre + " Square Yard : " + square_yard + "\n");
	}
}

function main()
{
	var obj = new MyMath();
	//Simple test
	obj.square_metre_to_square_yard(1);
	obj.square_metre_to_square_yard(12.7);
	obj.square_metre_to_square_yard(21);
}
main();

Output

Square Metre : 1 Square Yard : 1.196
Square Metre : 12.7 Square Yard : 15.189199999999998
Square Metre : 21 Square Yard : 25.116
# Python 3 program
# Convert the square metre to square yard

class MyMath :
	# Find the square metre of given square yard
	def square_metre_to_square_yard(self, square_metre) :
		#  Formula : (Square Metre * 1.196)
		#  Calculate square yard 
		square_yard = (square_metre * 1.196)
		print("Square Metre : ", square_metre ," Square Yard : ", square_yard ,"\n", end = "")
	

def main() :
	obj = MyMath()
	# Simple test
	obj.square_metre_to_square_yard(1)
	obj.square_metre_to_square_yard(12.7)
	obj.square_metre_to_square_yard(21)

if __name__ == "__main__": main()

Output

Square Metre :  1  Square Yard :  1.196
Square Metre :  12.7  Square Yard :  15.189199999999998
Square Metre :  21  Square Yard :  25.116
# Ruby program
# Convert the square metre to square yard

class MyMath

	# Find the square metre of given square yard
	def square_metre_to_square_yard(square_metre)
	
		#  Formula : (Square Metre * 1.196)
		#  Calculate square yard 
		square_yard = (square_metre * 1.196)
		print("Square Metre : ", square_metre ," Square Yard : ", square_yard ,"\n")
	end
end
def main()

	obj = MyMath.new()
	# Simple test
	obj.square_metre_to_square_yard(1)
	obj.square_metre_to_square_yard(12.7)
	obj.square_metre_to_square_yard(21)
end
main()

Output

Square Metre : 1 Square Yard : 1.196
Square Metre : 12.7 Square Yard : 15.189199999999998
Square Metre : 21 Square Yard : 25.116
/*
Scala program
Convert the square metre to square yard
*/
class MyMath
{
	//Find the square metre of given square yard
	def square_metre_to_square_yard(square_metre: Double): Unit = {
		// Formula : (Square Metre * 1.196)
		// Calculate square yard 
		var square_yard: Double = (square_metre * 1.196);
		print("Square Metre : " + square_metre + " Square Yard : " + square_yard + "\n");
	}
}
object Main
{
	def main(args: Array[String]): Unit = {
		var obj: MyMath = new MyMath();
		//Simple test
		obj.square_metre_to_square_yard(1);
		obj.square_metre_to_square_yard(12.7);
		obj.square_metre_to_square_yard(21);
	}
}

Output

Square Metre : 1.0 Square Yard : 1.196
Square Metre : 12.7 Square Yard : 15.189199999999998
Square Metre : 21.0 Square Yard : 25.116
/*
Swift program
Convert the square metre to square yard
*/
class MyMath
{
	//Find the square metre of given square yard
	func square_metre_to_square_yard(_ square_metre: Double)
	{
		// Formula : (Square Metre * 1.196)
		// Calculate square yard 
		let square_yard: Double = (square_metre * 1.196);
		print("Square Metre : ", square_metre ," Square Yard : ", square_yard ,"\n", terminator: "");
	}
}
func main()
{
	let obj: MyMath = MyMath();
	//Simple test
	obj.square_metre_to_square_yard(1);
	obj.square_metre_to_square_yard(12.7);
	obj.square_metre_to_square_yard(21);
}
main();

Output

Square Metre :  1.0  Square Yard :  1.196
Square Metre :  12.7  Square Yard :  15.1892
Square Metre :  21.0  Square Yard :  25.116

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