Algoritma:
- Tentukan variabel Nilai dan i sebagai
integer
- i ß 1
- while i <= 10
- cetak ”Please enter Nilai”
- input Nilai
- IF Nilai >= 60
- cetak ”LULUS”
- ELSE
- cetak ”TIDAK LULUS”
- i = i + 1
- endwhile
- cetak ”Selesai”
- Finish
Program Java, sbb:
class contoh7
{ public
static void main(String [] args)
{ BufferedReader in = new BufferedReader(
new
InputStreamReader(
System.in) );
String
oneLine;
int
Nilai, i = 1;
try{
while
( i <= 5)
{
System.out.print("
Please enter Nilai : ");
oneLine
= in.readLine();
Nilai
=Integer.parseInt( oneLine );
if
(Nilai >= 60)
System.out.println("LULUS");
else
System.out.println("TIDAK
LULUS");
i = i + 1;
}
System.out.println("Selesai");
}
catch(IOException
e){
}
}
}
No comments:
Post a Comment