DUNIA HAMPA SEKALI

♥ 1212~mnLnysm

konversi angka desimal ke jam

soal :
buat program untuk mengubah jam dalam bentuk desimal (diinput) menjadi jam, menit dan detik. Contoh 2.52 jam = 2 jam 31 menit 12 detik
jawaban :
#include<iostream.h>
#include<iomanip.h>
int a,b,c;
float n;
void main()
{
cout<<“Input Jam dalam bentuk desimal : “;
cin>>n;
c = n * 3600;
a = c / 3600;
c -= (a * 3600);
b = c / 60;
c -= (b * 60);
cout<<n<<” jam = “<<a<<” jam “<<b<<” menit “<<c<<” detik \n”;
}

May 6, 2010 - Posted by | c++

1 Comment »

  1. thank tpi kurang penjelasan jadi kita sendiri yang harus logikakan!! but thanks!!

    Comment by Hasbi Awal | June 21, 2011 | Reply


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: