fork download
  1. public class Main {
  2.  
  3. // ideone doesn't support cmd args
  4. static final String[] ARGS = {"5"};
  5.  
  6. public static void main (String[] args) {
  7. int n = Integer.parseInt(ARGS[0]);
  8. for (int i = 0; i < n; i++) {
  9. System.out.print('N');
  10. for (int j = 1; j < n-1; j++) {
  11. System.out.print(j == i ? 'N' : ' ');
  12. }
  13. System.out.println('N');
  14. }
  15. }
  16. }
Success #stdin #stdout 0.1s 320256KB
stdin
Standard input is empty
stdout
N   N
NN  N
N N N
N  NN
N   N