Advertisement
Alrarapie

belajarMenembak

Nov 12th, 2021
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.67 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class belajarMenembak {
  4.     public static void main(String[] args) {
  5.         Scanner scanner = new Scanner(System.in);
  6.         int n = scanner.nextInt();
  7.         char[] array = {'x','x','x','x','x'};
  8.         for (int i = 0; i < n; i++) {
  9.             int temp = scanner.next().charAt(1);
  10.             temp-='1';
  11.             array[temp]='o';
  12.         }
  13.         for (int i = 0; i < array.length; i++) {
  14.             if (i==0) System.out.print("| ");
  15.             System.out.print(array[i]+" ");
  16.             if (i==array.length-1) System.out.println("|");
  17.         }
  18.         System.out.println("-------------\n- LAPANGAN A -");
  19.     }
  20. }
  21.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement