Skip to main content

Convert the square yard to square meter

Here given code implementation process.

//C Program 
//Convert the square yard to square meter
#include <stdio.h>
 //Find the square metre of given square yard
void square_yard_to_square_metre(double square_yard)
{
	// Formula : (square_yard / 1.196)
	// Calculate given square_yard to square_metre 
	double square_metre = (square_yard / 1.196);
	//Display result
	printf("Square yard : %lf  Square Metre : %lf\n", square_yard, square_metre);
}
int main()
{
	//Simple test
	square_yard_to_square_metre(1);
	square_yard_to_square_metre(12.7);
	square_yard_to_square_metre(34);
	return 0;
}

Output

Square yard : 1.000000  Square Metre : 0.836120
Square yard : 12.700000  Square Metre : 10.618729
Square yard : 34.000000  Square Metre : 28.428094
/*
Java program
Convert the square yard to square meter
*/
class MyMath
{
	//Find the square metre of given square yard
	public void square_yard_to_square_metre(double square_yard)
	{
		// Formula : (square_yard / 1.196)
		// Calculate given square_yard to square_metre 
		double square_metre = (square_yard / 1.196);
		System.out.print("Square yard : " + square_yard + " Square Metre : " + square_metre + "\n");
	}
	public static void main(String[] args)
	{
		MyMath obj = new MyMath();
		//Simple test
		obj.square_yard_to_square_metre(1);
		obj.square_yard_to_square_metre(12.7);
		obj.square_yard_to_square_metre(34);
	}
}

Output

Square yard : 1.0 Square Metre : 0.8361204013377926
Square yard : 12.7 Square Metre : 10.618729096989966
Square yard : 34.0 Square Metre : 28.42809364548495
/*
C++ program
Convert the square yard to square meter
*/
#include<iostream>

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

Output

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

Output

Square yard : 1 Square Metre : 0.836120401337793
Square yard : 12.7 Square Metre : 10.61872909699
Square yard : 34 Square Metre : 28.4280936454849
<?php
/*
Php program
Convert the square yard to square meter
*/
class MyMath
{
	//Find the square metre of given square yard
	public	function square_yard_to_square_metre($square_yard)
	{
		// Formula : (square_yard / 1.196)
		// Calculate given square_yard to square_metre 
		$square_metre = ($square_yard / 1.196);
		echo "Square yard : ". $square_yard ." Square Metre : ". $square_metre ."\n";
	}
}

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

Output

Square yard : 1 Square Metre : 0.83612040133779
Square yard : 12.7 Square Metre : 10.61872909699
Square yard : 34 Square Metre : 28.428093645485
/*
Node Js program
Convert the square yard to square meter
*/
class MyMath
{
	//Find the square metre of given square yard
	square_yard_to_square_metre(square_yard)
	{
		// Formula : (square_yard / 1.196)
		// Calculate given square_yard to square_metre 
		var square_metre = (square_yard / 1.196);
		process.stdout.write("Square yard : " + square_yard + " Square Metre : " + square_metre + "\n");
	}
}

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

Output

Square yard : 1 Square Metre : 0.8361204013377926
Square yard : 12.7 Square Metre : 10.618729096989966
Square yard : 34 Square Metre : 28.42809364548495
# Python 3 program
# Convert the square yard to square meter

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

def main() :
	obj = MyMath()
	# Simple test
	obj.square_yard_to_square_metre(1)
	obj.square_yard_to_square_metre(12.7)
	obj.square_yard_to_square_metre(34)

if __name__ == "__main__": main()

Output

Square yard :  1  Square Metre :  0.8361204013377926
Square yard :  12.7  Square Metre :  10.618729096989966
Square yard :  34  Square Metre :  28.42809364548495
# Ruby program
# Convert the square yard to square meter

class MyMath

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

	obj = MyMath.new()
	# Simple test
	obj.square_yard_to_square_metre(1)
	obj.square_yard_to_square_metre(12.7)
	obj.square_yard_to_square_metre(34)
end
main()

Output

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

Output

Square yard : 1.0 Square Metre : 0.8361204013377926
Square yard : 12.7 Square Metre : 10.618729096989966
Square yard : 34.0 Square Metre : 28.42809364548495
/*
Swift program
Convert the square yard to square meter
*/
class MyMath
{
	//Find the square metre of given square yard
	func square_yard_to_square_metre(_ square_yard: Double)
	{
		// Formula : (square_yard / 1.196)
		// Calculate given square_yard to square_metre 
		let square_metre: Double = (square_yard / 1.196);
		print("Square yard : ", square_yard ," Square Metre : ", square_metre ,"\n", terminator: "");
	}
}
func main()
{
	let obj: MyMath = MyMath();
	//Simple test
	obj.square_yard_to_square_metre(1);
	obj.square_yard_to_square_metre(12.7);
	obj.square_yard_to_square_metre(34);
}
main();

Output

Square yard :  1.0  Square Metre :  0.836120401337793
Square yard :  12.7  Square Metre :  10.61872909699
Square yard :  34.0  Square Metre :  28.4280936454849




Comment

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