program-nama-bulan-menggunakan-bahasa-c.html
Berikut Listing program untuk menginput angka dan menghasilkan nama bulan :
#include
void main ()
{
int bulan;
printf("Masukkan angka bulan (1-12) : ");
scanf("%d",&bulan);
switch (bulan)
{
case 1:printf("Januari\n");
break;
case 2:printf("Februari\n");
break;
case 3:printf("Maret\n");
break;
case 4:printf("April\n");
break;
case 5:printf("Mei\n");
break;
case 6:printf("Juni\n");
break;
case 7:printf("Juli\n");
break;
case 8:printf("Agustus\n");
break;
case 9:printf("September\n");
break;
case 10:printf("Oktober\n");
break;
case 11:printf("November\n");
break;
case 12:printf("Desember\n");
break;
default:printf("Salah!\n");
}
}
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEio7LaAodvFd0QgQE85ZHKTnpnw25mcaBHKFJkpPeZq3DQm616ZCmi8-9bzF7_N2romki-__XE6qxXIVkVwqX7PxNRZAVtITzXLvF5L2QulgQ_Dby_tJEtidz_W26Esocr0nCWF0L8Uv2vr/s1600/image2.png
#include
void main ()
{
int bulan;
printf("Masukkan angka bulan (1-12) : ");
scanf("%d",&bulan);
switch (bulan)
{
case 1:printf("Januari\n");
break;
case 2:printf("Februari\n");
break;
case 3:printf("Maret\n");
break;
case 4:printf("April\n");
break;
case 5:printf("Mei\n");
break;
case 6:printf("Juni\n");
break;
case 7:printf("Juli\n");
break;
case 8:printf("Agustus\n");
break;
case 9:printf("September\n");
break;
case 10:printf("Oktober\n");
break;
case 11:printf("November\n");
break;
case 12:printf("Desember\n");
break;
default:printf("Salah!\n");
}
}
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEio7LaAodvFd0QgQE85ZHKTnpnw25mcaBHKFJkpPeZq3DQm616ZCmi8-9bzF7_N2romki-__XE6qxXIVkVwqX7PxNRZAVtITzXLvF5L2QulgQ_Dby_tJEtidz_W26Esocr0nCWF0L8Uv2vr/s1600/image2.png
Komentar
Posting Komentar