-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathTenHellos.java
More file actions
32 lines (30 loc) · 811 Bytes
/
TenHellos.java
File metadata and controls
32 lines (30 loc) · 811 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
/******************************************************************************
* Compilation: javac TenHellos.java
* Execution: java TenHellos
*
* Prints ith Hello for i = 1 to 10. Illlustrates using a while loop
* for a repetitive task.
*
* % java TenHellos
* 1st Hello
* 2nd Hello
* 3rd Hello
* 4th Hello
* 5th Hello
* 6th Hello
* 7th Hello
* 8th Hello
* 9th Hello
* 10th Hello
*
******************************************************************************/
public class TenHellos {
public static void main(String[] args) {
System.out.println("1st Hello");
System.out.println("2nd Hello");
System.out.println("3rd Hello");
for (int i = 4; i <= 10; i++) {
System.out.println(i + "th Hello");
}
}
}