Contoh Materi Array 2 ” Tahun “

#include <iostream.h>
#include <conio.h>
int main()

{

int jmlHari[12]={31,28,31,30,31,30,31,31,30,31,30,31};
int bulan, tahun, jHari;
cout <<“masukkan bulan <1….12>: “;cin >> bulan;
cout << “masukkan tahun : “; cin >>tahun;
if (bulan==2)
if((tahun%4==0)&&(tahun%100!=0))
jHari=29;
else
jHari=28;
else
jHari=jmlHari(bulan-1);

cout << “Jumlah Hari pada “<<endl;
cout << ” Bulan : “<<bulan;
cout << ” Tahun : “<<tahun;
cout <<” adalah : “<<jHari<<endl;

return 0;
}

One thought on “Contoh Materi Array 2 ” Tahun “

Tinggalkan Balasan

Please log in using one of these methods to post your comment:

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