Advertisement
Guest User

zad1

a guest
Nov 25th, 2017
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.55 KB | None | 0 0
  1.     public static void main(String[] args) {
  2.  
  3.         char[] tab = {'a', 'b', 'c', 'e', 'f'};
  4.         for (int i = 0; i < tab.length; i++) {
  5.             if (i > 0) {
  6.                 System.out.print(tab[i - 1]);
  7.             } else {
  8.                 System.out.print(tab[tab.length - 1]);
  9.             }
  10.             System.out.print(tab[i]);
  11.             if (i < tab.length - 1) {
  12.                 System.out.print(tab[i + 1]);
  13.             } else {
  14.                 System.out.print(tab[0]);
  15.             }
  16.             System.out.println();
  17.         }
  18.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement