programmingex5 6 java

Solutions on MaxInterview for programmingex5 6 java by the best coders in the world

showing results for - "programmingex5 6 java"
Maximilian
25 Mar 2020
1public class ProgrammingEx5_6 {
2 
3 public static void main(String[] args) {
4  final int END = 10;
5  final int MILES_START = 20;
6 
7  // printing table header
8  System.out.printf("%-9s%15s", "Miles", "Kilometers");
9  System.out.print("\t|\t");
10  System.out.printf("%-9s%15s\n", "Kilometers", "Miles");
11 
12  for (int j = 0, i = 1; i <= END; i++, j += 5) {
13   System.out.printf("%-9d%15.3f", i, i * 1.609);
14   System.out.print("\t|\t");
15   System.out.printf("%-9d%15.3f\n", MILES_START + j,
16     (MILES_START + j) / 1.609);
17 
18  }
19 
20 }
21}
22
similar questions
queries leading to this page
programmingex5 6 java