3
05/11/2024 2:56 pm
Topic starter
You will be given an integer that will be distance in meters. Write a program that converts meters to kilometers formatted to the second decimal point.
Examples:
1 Answer
2
05/11/2024 2:57 pm
Use number_format (string function) /line 6 to format the kilometers to the second decimal point:
<?php $inputMeters = intval(readline()); $kilometers = $inputMeters / 1000; echo number_format($kilometers, 2, '.', '');