PHP program to enter the length in centimeter and convert it into meter and kilometer
PHP program to enter the length in centimeters and convert it into meters and kilometers.
There are you will learn how to convert the centimeter into meter and kilometer in PHP language.
1m = 100cm
1km = 100000cm
Let us understand this example through the PHP program:
<?php // PHP program to convert centimeter into meter and kilometer $c = 100; $m = 0; $k = 0; // c = centimeter // m = meter // k = kilometer // Convert centimeter into meter and kilometer $m = (float)($c / 100); $k = (float)($c / 100000); // Output printf("Length in Meter = " . $m . " meter\n"); printf("Length in Kilometer = " . $k . " kilometer\n"); ?>
Length in Meter = 1 meter
Length in Kilometer = 0.001 kilometer