mengitung konversi km ke cm, Bahasa C

Posted: November 21, 2010 in Bahasa C

by. Ridwan aceh

jngan dicopy paste ya,,, pelajari dulu…

=========================================
*mengitung konversi km ke cm
=========================================
#include

int main(void)
{
float km,m,cm,sisa,cm2,km2,m2;

printf(“Jarak dalam kilometer (km) = “);
scanf(“%f”,&km);

m=km*1000;
cm=km*100000;

printf(“\nJarak dalam meter (m) = %.0f m”,m);
printf(“\nJarak dalam centimeter (cm) = %.0f cm”,cm);

printf(“\n\nJarak dalam centimeter (cm) = “);
scanf(“%f”,&cm2);

km2=(int)cm2 / 100000;
sisa=cm2-(km2*100000);
sisa=sisa/100;
printf(“\nJarak dalam kilometer (km) dan meter (m) = %.0f km %.0f m”,km2,sisa);

return 0;
}

Tinggalkan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout / Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout / Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout / Ubah )

Foto Google+

You are commenting using your Google+ account. Logout / Ubah )

Connecting to %s