# Convert hectare to square kilometer

Here given code implementation process.

``````//C Program
//Convert hectare to square kilometer
#include <stdio.h>
//Find the square kilometer of given hectare
void hectare_to_square_km(double hectare)
{
// Calculate square kilometer by using hectare
// Formula : (hectare / 100)
double square_km = (hectare / 100);
printf("[%lf] Hectare is equal to [%lf] Square Kilometer \n", hectare, square_km);
}
int main()
{
//Simple test
hectare_to_square_km(1);
hectare_to_square_km(2021);
hectare_to_square_km(1500.6);
return 0;
}``````

#### Output

``````[1.000000] Hectare is equal to [0.010000] Square Kilometer
[2021.000000] Hectare is equal to [20.210000] Square Kilometer
[1500.600000] Hectare is equal to [15.006000] Square Kilometer``````
``````/*
Java program
Convert hectare to square kilometer
*/
class MyMath
{ //Find the square kilometer of given hectare
public void hectare_to_square_km(double hectare)
{
// Calculate square kilometer by using hectare
// Formula : (hectare / 100)
double square_km = (hectare / 100);
System.out.print("[" + hectare + "] Hectare is equal to [" + square_km + "] Square Kilometer \n");
}
public static void main(String[] args)
{
MyMath obj = new MyMath();
//Simple test
obj.hectare_to_square_km(1);
obj.hectare_to_square_km(2021);
obj.hectare_to_square_km(1500.6);
}
}``````

#### Output

``````[1.0] Hectare is equal to [0.01] Square Kilometer
[2021.0] Hectare is equal to [20.21] Square Kilometer
[1500.6] Hectare is equal to [15.005999999999998] Square Kilometer``````
``````//Include header file
#include <iostream>
using namespace std;

/*
C++ program
Convert hectare to square kilometer
*/
class MyMath
{
public:
//Find the square kilometer of given hectare
void hectare_to_square_km(double hectare)
{
// Calculate square kilometer by using hectare
// Formula : (hectare / 100)
double square_km = (hectare / 100);
cout << "[" << hectare << "] Hectare is equal to [" << square_km << "] Square Kilometer \n";
}
};
int main()
{
MyMath obj = MyMath();
//Simple test
obj.hectare_to_square_km(1);
obj.hectare_to_square_km(2021);
obj.hectare_to_square_km(1500.6);
return 0;
}``````

#### Output

`````` Hectare is equal to [0.01] Square Kilometer
 Hectare is equal to [20.21] Square Kilometer
[1500.6] Hectare is equal to [15.006] Square Kilometer``````
``````/*
C# program
Convert hectare to square kilometer
*/
//Include namespace system
using System;
class MyMath
{
//Find the square kilometer of given hectare
public void hectare_to_square_km(double hectare)
{
// Calculate square kilometer by using hectare
// Formula : (hectare / 100)
double square_km = (hectare / 100);
Console.Write("[" + hectare + "] Hectare is equal to [" + square_km + "] Square Kilometer \n");
}
public static void Main(String[] args)
{
MyMath obj = new MyMath();
//Simple test
obj.hectare_to_square_km(1);
obj.hectare_to_square_km(2021);
obj.hectare_to_square_km(1500.6);
}
}``````

#### Output

`````` Hectare is equal to [0.01] Square Kilometer
 Hectare is equal to [20.21] Square Kilometer
[1500.6] Hectare is equal to [15.006] Square Kilometer``````
``````<?php
/*
Php program
Convert hectare to square kilometer
*/
class MyMath
{
//Find the square kilometer of given hectare
public	function hectare_to_square_km(\$hectare)
{
// Calculate square kilometer by using hectare
// Formula : (hectare / 100)
\$square_km = (\$hectare / 100);
echo "[". \$hectare ."] Hectare is equal to [". \$square_km ."] Square Kilometer \n";
}
}

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

#### Output

`````` Hectare is equal to [0.01] Square Kilometer
 Hectare is equal to [20.21] Square Kilometer
[1500.6] Hectare is equal to [15.006] Square Kilometer``````
``````/*
Node Js program
Convert hectare to square kilometer
*/
class MyMath
{
//Find the square kilometer of given hectare
hectare_to_square_km(hectare)
{
// Calculate square kilometer by using hectare
// Formula : (hectare / 100)
var square_km = (hectare / 100);
process.stdout.write("[" + hectare + "] Hectare is equal to [" + square_km + "] Square Kilometer \n");
}
}

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

#### Output

`````` Hectare is equal to [0.01] Square Kilometer
 Hectare is equal to [20.21] Square Kilometer
[1500.6] Hectare is equal to [15.005999999999998] Square Kilometer``````
``````# Python 3 program
# Convert hectare to square kilometer

class MyMath :
# Find the square kilometer of given hectare
def hectare_to_square_km(self, hectare) :
#  Calculate square kilometer by using hectare
#  Formula : (hectare / 100)
square_km = (hectare / 100)
print("[", hectare ,"] Hectare is equal to [", square_km ,"] Square Kilometer \n", end = "")

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

if __name__ == "__main__": main()``````

#### Output

``````[ 1 ] Hectare is equal to [ 0.01 ] Square Kilometer
[ 2021 ] Hectare is equal to [ 20.21 ] Square Kilometer
[ 1500.6 ] Hectare is equal to [ 15.005999999999998 ] Square Kilometer``````
``````# Ruby program
# Convert hectare to square kilometer

class MyMath

# Find the square kilometer of given hectare
def hectare_to_square_km(hectare)

#  Calculate square kilometer by using hectare
#  Formula : (hectare / 100)
square_km = (hectare / 100)
print("[", hectare ,"] Hectare is equal to [", square_km ,"] Square Kilometer \n")
end
end
def main()

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

#### Output

`````` Hectare is equal to  Square Kilometer
 Hectare is equal to  Square Kilometer
[1500.6] Hectare is equal to [15.005999999999998] Square Kilometer
``````
``````/*
Scala program
Convert hectare to square kilometer
*/
class MyMath
{
//Find the square kilometer of given hectare
def hectare_to_square_km(hectare: Double): Unit = {
// Calculate square kilometer by using hectare
// Formula : (hectare / 100)
var square_km: Double = (hectare / 100);
print("[" + hectare + "] Hectare is equal to [" + square_km + "] Square Kilometer \n");
}
}
object Main
{
def main(args: Array[String]): Unit = {
var obj: MyMath = new MyMath();
//Simple test
obj.hectare_to_square_km(1);
obj.hectare_to_square_km(2021);
obj.hectare_to_square_km(1500.6);
}
}``````

#### Output

``````[1.0] Hectare is equal to [0.01] Square Kilometer
[2021.0] Hectare is equal to [20.21] Square Kilometer
[1500.6] Hectare is equal to [15.005999999999998] Square Kilometer``````
``````/*
Swift program
Convert hectare to square kilometer
*/
class MyMath
{
//Find the square kilometer of given hectare
func hectare_to_square_km(_ hectare: Double)
{
// Calculate square kilometer by using hectare
// Formula : (hectare / 100)
let square_km: Double = (hectare / 100);
print("[", hectare ,"] Hectare is equal to [", square_km ,"] Square Kilometer \n", terminator: "");
}
}
func main()
{
let obj: MyMath = MyMath();
//Simple test
obj.hectare_to_square_km(1);
obj.hectare_to_square_km(2021);
obj.hectare_to_square_km(1500.6);
}
main();``````

#### Output

``````[ 1.0 ] Hectare is equal to [ 0.01 ] Square Kilometer
[ 2021.0 ] Hectare is equal to [ 20.21 ] Square Kilometer
[ 1500.6 ] Hectare is equal to [ 15.006 ] Square Kilometer``````

## 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.