Example Lab 4.1
[1] Question :
(Conversion from miles to kilometers)
Write a program that displays the following table (note that 1 mile is 1.609 kilometers):
[2] Example Code :
------------------------------------------------------------------------------------------------------------------------
// Step 1 : Use while loop
int miles = 1;
while (miles <= ___________)
{
// Step 2 : Calculation
_________________________________
// Step 3 : Display Result
System.out.println(________________);
miles++;
}
-------------------------------------------------------------------------------------------------------------------------
DCT 1093 - Lab 4 - Loops (Lab 4.1)
Thursday, 10 January 2013
You can leave a response
zT-FKMPT
Jabatan Sains Komputer . Fakulti Komputer, Media, & Pengurusan Teknologi . TATIUC