Advertisement
Guest User

EsFiltro

a guest
Feb 20th, 2018
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.61 KB | None | 0 0
  1. public class EsFiltro{
  2.     public static void car(int n){
  3.         char val='A';
  4.         for(int i=0;i<n;i++){
  5.             System.out.print(val);
  6.             if(i!=n-1)
  7.                 System.out.print(" ");
  8.             val=(char)(val+1);
  9.             }
  10.     }
  11.  
  12.     public static void main(String[] args){
  13.         int n=Integer.parseInt(args[0]);
  14.         if(n<0)
  15.             System.out.println("Errore");
  16.         else
  17.             if(n>0) {
  18.                 if(n>1)
  19.                     for(int i=1; i<n; i++) {
  20.                         car(i);
  21.                         System.out.println();
  22.                     }
  23.                 car(n);
  24.                 if(n>1){
  25.                     System.out.println();
  26.                     for(int j=n-1;j>=1;j--) {
  27.                         car(j);
  28.                         if(j!=1)
  29.                         System.out.println();
  30.                     }
  31.                 }
  32.             }
  33.     }
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement