Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Do-While Loop EXamples, Assignments of Java Programming

Do-While Loop Examples JAVA PROGRAMMING exercises

Typology: Assignments

2020/2021

Uploaded on 01/28/2022

eunice-salcedo
eunice-salcedo 🇵🇭

5

(1)

1 document

1 / 3

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
SALCEDO, Eunice Marian J.
BSCE 2-5
MT 9:30-11:00 AM
Computer Fundamentals and Programming 2
JAVA PROGRAM 1:
SOURCE CODES
OUTPUT
pf3

Partial preview of the text

Download Do-While Loop EXamples and more Assignments Java Programming in PDF only on Docsity!

SALCEDO, Eunice Marian J.

BSCE 2-

MT 9:30-11:00 AM

Computer Fundamentals and Programming 2

JAVA PROGRAM 1:

SOURCE CODES

OUTPUT

EXPLANATION

This program will be able to display numbers from 11 to 20. I specifically chose these numbers as

they have personal meanings to me. The program will execute in the following manner. First, the

program starts. 'i' is initialized with value 11. Execution enters the loop and 11 is printed as 'i' is

increased to 12. When i is increased to 12, condition is checked. 12 <= 20 yields true so 12 is

printed and i is increased to 13. Again, condition is checked. 13 <= 20 yields true so 13 is printed.

'i' is increased to 14 and condition is checked. 14 <= 20 yields true so 14 is printed. 'i' is increased

to 15 and condition is checked. 15 <=20 yields true so 15 is printed. The process is repeated until

'i' is increased to 20 since 20 <= 20 is still true. When 'i' is increased to 21, the loop is terminated

because 21 <= 20 is false.

JAVA PROGRAM 2:

SOURCE CODES