all about me: CODING C LOOP
...SELAMAT DATANG ...TERIMA KASIH ...TELAH BERKUNJUNG
RSS

CODING C LOOP

coding loop menggunakan "if else".
#include
main()
{

int mamat;
printf("\n masukan nilai anda :");
scanf("%d", &mamat);
if (mamat >=90)
printf("grade A");
else if (mamat >=80 && mamat <=89)
printf("grade B");
else if (mamat >=70 && mamat <=79)
printf("grade C");
else
printf("grade D");
}


coding loop menggunakan "switch case"

#include
main()
{
int mamat;
printf("masukan pilihan dari 1-7 :");
scanf("%d", &mamat);

switch(mamat)
{
case 1:{printf("senin"); break;}
case 2:{printf("selasa"); break;}
case 3:{printf("rabu"); break;}
case 4:{printf("kamis"); break;}
case 5:{printf("jum'at"); break;}
case 6:{printf("sabtu"); break;}
case 7:{printf("minggu"); break;}
default :{printf("error boy"); break;}
}
}



share for life...........tolong comment y klo ada yg error....

0 comments:

Post a Comment