logo

Program za pretvaranje kilometara u cm

Ovdje ćemo naučiti kako pretvoriti vrijednost duljine, koja je dana u kilometrima, u duljinu u centimetrima.

Ako želimo pretvoriti vrijednost kilometra u vrijednost u cm, tada moramo koristiti sljedeću formulu:

1 km = 100 000 cm. cm = 100000 * Kilometar.

Program 1: Napišite program u C-u za pretvaranje vrijednosti duljine kilometra u centimetar.

 #include int main() { double Kilometer = 4; double centimeter; centimeter = 100000 * Kilometer; printf ('Value of 4 kilometer in Centimeter is:', centimeter); return 0; } 

Izlaz:

 Value of 4 kilometer in Centimeter is: 400000 

Program 2: Napišite program u PHP-u za pretvaranje vrijednosti kilometra u cm.

 <?php // This is a PHP program which converts the value of Kilometer into the value of cm $Kilometer = 10.4; $centimeter = 100000 * $Kilometer; echo('Value of 10.4 Kilometer in Centimeter is ' . $centimeter . '
'); ?> 

Izlaz:

 Value of 10.4 Kilometer in Centimeter is: 1040000 

Program 3: Napišite program u Javi za pretvaranje vrijednosti kilometra u cm.

 // This is a Java program which converts the value of Kilometer into the value in cm import java.io.*; class convert { static double Conversion_Kilometer_to_cm(int Kilometer) { double centimeter; centimeter = 100000 * Kilometer; System.out.printf(&apos;Value in Centimeter is: %.2f 
&apos;, centimeter); return 0; } public static void main(String args []) { int Kilometer = 2.008457; Conversion_Kilometer_to_cm(Kilometer); } } 

Izlaz:

 Value in Centimeter is: 200845.70 

Program 4: Napišite program u Pythonu za pretvaranje vrijednosti kilometra u cm.

 # This is a Python program which converts the value of Kilometer into cm Kilometer=int(input(&apos;Enter the length in Kilometer:&apos;)) #convert Kilometer to cm centimeter = 100000 * Kilometer; print(&apos;The length in centimeter&apos;,round(centimeter,2)) 

Izlaz:

 Enter the length in Kilometer: 25 The length in centimeter 2500000.00