Rabu, 13 April 2011

contoh program c++ bulan & angka

#include <iostream.h>
#include <cstdlib>
int main ()
{
int angka;

cout<<"input angka =";
cin>>angka;

switch (angka)
{
case 2:cout<<"31 hari \n";
break;
    case 1:
case 3:
    case 5:
case 7:
case 8:
    case 10:
case 12:cout<<"31 hari \n";
break;

    case 4:
case 6:
    case 9:
case 11:cout<<"30 hari \n";
break;
}
return 0;
}


0 komentar:

Posting Komentar