Thursday, 15 December 2011

switch-case


/*switch-case-default*/
#include<stdio.h>
#include<conio.h>
#include<iostream.h>
void main()
{
clrscr();
int hari;
printf("1.Minggu  2. Senin   3. Selasa   4. Rabu\n");
printf("5. Kamis  6. Jum'at  7. Sabtu\n");
printf("Masukkan Kode Hari = ");scanf("%i",&hari);
switch(hari)
{
case 1:printf("Hari Minggu");
break;
case 2:printf("Hari Senin");
break;
case 3:printf("Hari Selasa");
break;
case 4:printf("Hari Rabu");
break;
case 5:printf("Hari Kamis");
break;
case 6:printf("Hari Jum'at");
break;
case 7:printf("Hari Sabtu");
break;
default:printf("Kodeyang anda masukkan salah");
}
getch();
}

No comments:

Post a Comment