1 import java.util.Scanner;
2
3 public class Tiles
4 {
5 public static void main(String[] args)
6 {
7 Scanner in = new Scanner(System.in);
8
9 System.out.print("Total width: ");
10 int totalWidth = in.nextInt();
11 System.out.print("Tile width: ");
12 int tileWidth = in.nextInt();
13
14 int numberOfPairs = (totalWidth - tileWidth) / (2 * tileWidth);
15 int numberOfTiles = 1 + 2 * numberOfPairs;
16 double gap = (totalWidth - numberOfTiles * tileWidth) / 2.0;
17
18 System.out.println("Number of tiles: " + numberOfTiles);
19 System.out.println("Gap at each end: " + gap);
20 }
21 }