FUNGS IF DENGAN 1 INPUT DAN 2 OUTPUT
///proses pengkondisian
if (nilai >= 90 && nilai <= 100)
{
ket = "A";
ket2 = "Sangat Baik";
}
else if (nilai >= 80 && nilai < 90)
{
ket = "B";
ket2 = "Baik";
}
else if (nilai >= 70 && nilai < 80)
{
ket = "C";
ket2 = "Cukup";
}
else if (nilai >= 60 && nilai < 70)
{
ket = "D";
ket2 = "Kurang";
}
else if (nilai >= 0 && nilai < 60)
{
ket = "E";
ket2 = "Jelek";
}
else
{
ket = "Range Nilai Hanya Boleh 0...100";
ket2 = "Silahkan Mengulang Lagi";
}
//tampilkan output
printf("Keterangan : %s",ket);
printf("\nPenilaian : %s",ket2);
}
#include <stdio.h>
main()
{
//deklarasi variabel
int nilai;
char *ket,*ket2;
//deskripsi input
printf("Inputkan Nilai Ujian [0...100] : ");
scanf("%d",&nilai);
main()
{
//deklarasi variabel
int nilai;
char *ket,*ket2;
//deskripsi input
printf("Inputkan Nilai Ujian [0...100] : ");
scanf("%d",&nilai);
///proses pengkondisian
if (nilai >= 90 && nilai <= 100)
{
ket = "A";
ket2 = "Sangat Baik";
}
else if (nilai >= 80 && nilai < 90)
{
ket = "B";
ket2 = "Baik";
}
else if (nilai >= 70 && nilai < 80)
{
ket = "C";
ket2 = "Cukup";
}
else if (nilai >= 60 && nilai < 70)
{
ket = "D";
ket2 = "Kurang";
}
else if (nilai >= 0 && nilai < 60)
{
ket = "E";
ket2 = "Jelek";
}
else
{
ket = "Range Nilai Hanya Boleh 0...100";
ket2 = "Silahkan Mengulang Lagi";
}
//tampilkan output
printf("Keterangan : %s",ket);
printf("\nPenilaian : %s",ket2);
}
No comments:
Post a Comment