Convert the square inch to square yard

Here given code implementation process.

//C Program 
//Convert the square inch to square yard
#include <stdio.h>
 //Find the square inch of given square yard
void square_inch_to_square_yard(double square_inch)
{
	// Calculate square yard 
	// Formula : (Square inch / 1296)
	double square_yard = (square_inch / 1296);
	printf("Square inch : %lf, Square yard : %lf\n", square_inch, square_yard);
}
int main()
{
	//Simple test
	square_inch_to_square_yard(1);
	square_inch_to_square_yard(2021);
	square_inch_to_square_yard(1500.6);
	return 0;
}

Output

Square inch : 1.000000, Square yard : 0.000772
Square inch : 2021.000000, Square yard : 1.559414
Square inch : 1500.600000, Square yard : 1.157870
/*
Java program
Convert the square inch to square yard
*/
class MyMath
{
	//Find the square inch of given square yard
	public void square_inch_to_square_yard(double square_inch)
	{
		// Calculate square yard 
		// Formula : (Square inch / 1296)
		double square_yard = (square_inch / 1296);
		System.out.print("Square inch : " + square_inch + " , Square yard : " + square_yard + "\n");
	}
	public static void main(String[] args)
	{
		MyMath obj = new MyMath();
		//Simple test
		obj.square_inch_to_square_yard(1);
		obj.square_inch_to_square_yard(2021);
		obj.square_inch_to_square_yard(1500.6);
	}
}

Output

Square inch : 1.0 , Square yard : 7.716049382716049E-4
Square inch : 2021.0 , Square yard : 1.5594135802469136
Square inch : 1500.6 , Square yard : 1.1578703703703703
/*
C++ program
Convert the square inch to square yard
*/
#include<iostream>

using namespace std;
class MyMath
{
	public:
		//Find the square inch of given square yard
		void square_inch_to_square_yard(double square_inch)
		{
			// Calculate square yard 
			// Formula : (Square inch / 1296)
			double square_yard = (square_inch / 1296);
			cout << "Square inch : " << square_inch << " , Square yard : " << square_yard << "\n";
		}
};
int main()
{
	MyMath obj;
	//Simple test
	obj.square_inch_to_square_yard(1);
	obj.square_inch_to_square_yard(2021);
	obj.square_inch_to_square_yard(1500.6);
	return 0;
}

Output

Square inch : 1 , Square yard : 0.000771605
Square inch : 2021 , Square yard : 1.55941
Square inch : 1500.6 , Square yard : 1.15787
/*
C# program
Convert the square inch to square yard
*/
using System;
class MyMath
{
	//Find the square inch of given square yard
	public void square_inch_to_square_yard(double square_inch)
	{
		// Calculate square yard 
		// Formula : (Square inch / 1296)
		double square_yard = (square_inch / 1296);
		Console.Write("Square inch : " + square_inch + " , Square yard : " + square_yard + "\n");
	}
	public static void Main(String[] args)
	{
		MyMath obj = new MyMath();
		//Simple test
		obj.square_inch_to_square_yard(1);
		obj.square_inch_to_square_yard(2021);
		obj.square_inch_to_square_yard(1500.6);
	}
}

Output

Square inch : 1 , Square yard : 0.000771604938271605
Square inch : 2021 , Square yard : 1.55941358024691
Square inch : 1500.6 , Square yard : 1.15787037037037
<?php
/*
Php program
Convert the square inch to square yard
*/
class MyMath
{
	//Find the square inch of given square yard
	public	function square_inch_to_square_yard($square_inch)
	{
		// Calculate square yard 
		// Formula : (Square inch / 1296)
		$square_yard = ($square_inch / 1296);
		echo "Square inch : ". $square_inch ." , Square yard : ". $square_yard ."\n";
	}
}

function main()
{
	$obj = new MyMath();
	//Simple test
	$obj->square_inch_to_square_yard(1);
	$obj->square_inch_to_square_yard(2021);
	$obj->square_inch_to_square_yard(1500.6);
}
main();

Output

Square inch : 1 , Square yard : 0.0007716049382716
Square inch : 2021 , Square yard : 1.5594135802469
Square inch : 1500.6 , Square yard : 1.1578703703704
/*
Node Js program
Convert the square inch to square yard
*/
class MyMath
{
	//Find the square inch of given square yard
	square_inch_to_square_yard(square_inch)
	{
		// Calculate square yard 
		// Formula : (Square inch / 1296)
		var square_yard = (square_inch / 1296);
		process.stdout.write("Square inch : " + square_inch + " , Square yard : " + square_yard + "\n");
	}
}

function main()
{
	var obj = new MyMath();
	//Simple test
	obj.square_inch_to_square_yard(1);
	obj.square_inch_to_square_yard(2021);
	obj.square_inch_to_square_yard(1500.6);
}
main();

Output

Square inch : 1 , Square yard : 0.0007716049382716049
Square inch : 2021 , Square yard : 1.5594135802469136
Square inch : 1500.6 , Square yard : 1.1578703703703703
# Python 3 program
# Convert the square inch to square yard

class MyMath :
	# Find the square inch of given square yard
	def square_inch_to_square_yard(self, square_inch) :
		#  Calculate square yard 
		#  Formula : (Square inch / 1296)
		square_yard = (square_inch / 1296)
		print("Square inch : ", square_inch ," , Square yard : ", square_yard ,"\n", end = "")
	

def main() :
	obj = MyMath()
	# Simple test
	obj.square_inch_to_square_yard(1)
	obj.square_inch_to_square_yard(2021)
	obj.square_inch_to_square_yard(1500.6)

if __name__ == "__main__": main()

Output

Square inch :  1  , Square yard :  0.0007716049382716049
Square inch :  2021  , Square yard :  1.5594135802469136
Square inch :  1500.6  , Square yard :  1.1578703703703703
# Ruby program
# Convert the square inch to square yard

class MyMath

	# Find the square inch of given square yard
	def square_inch_to_square_yard(square_inch)
	
		#  Calculate square yard 
		#  Formula : (Square inch / 1296)
		square_yard = (square_inch / 1296.0)
		print("Square inch : ", square_inch ," , Square yard : ", square_yard ,"\n")
	end
end
def main()

	obj = MyMath.new()
	# Simple test
	obj.square_inch_to_square_yard(1)
	obj.square_inch_to_square_yard(2021)
	obj.square_inch_to_square_yard(1500.6)
end
main()

Output

Square inch : 1 , Square yard : 0.0007716049382716049
Square inch : 2021 , Square yard : 1.5594135802469136
Square inch : 1500.6 , Square yard : 1.1578703703703703
/*
Scala program
Convert the square inch to square yard
*/
class MyMath
{
	//Find the square inch of given square yard
	def square_inch_to_square_yard(square_inch: Double): Unit = {
		// Calculate square yard 
		// Formula : (Square inch / 1296)
		var square_yard: Double = (square_inch / 1296);
		print("Square inch : " + square_inch + " , Square yard : " + square_yard + "\n");
	}
}
object Main
{
	def main(args: Array[String]): Unit = {
		var obj: MyMath = new MyMath();
		//Simple test
		obj.square_inch_to_square_yard(1);
		obj.square_inch_to_square_yard(2021);
		obj.square_inch_to_square_yard(1500.6);
	}
}

Output

Square inch : 1.0 , Square yard : 7.716049382716049E-4
Square inch : 2021.0 , Square yard : 1.5594135802469136
Square inch : 1500.6 , Square yard : 1.1578703703703703
/*
Swift program
Convert the square inch to square yard
*/
class MyMath
{
	//Find the square inch of given square yard
	func square_inch_to_square_yard(_ square_inch: Double)
	{
		// Calculate square yard 
		// Formula : (Square inch / 1296)
		let square_yard: Double = (square_inch / 1296);
		print("Square inch : ", square_inch ," , Square yard : ", square_yard ,"\n", terminator: "");
	}
}
func main()
{
	let obj: MyMath = MyMath();
	//Simple test
	obj.square_inch_to_square_yard(1);
	obj.square_inch_to_square_yard(2021);
	obj.square_inch_to_square_yard(1500.6);
}
main();

Output

Square inch :  1.0  , Square yard :  0.000771604938271605
Square inch :  2021.0  , Square yard :  1.55941358024691
Square inch :  1500.6  , Square yard :  1.15787037037037


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