Link to home
Start Free TrialLog in
Avatar of SunScreenCert
SunScreenCert

asked on

Tips to improve this program

The output of this program is correct and as expected. It is actually a metric of multiplication.

Please advice me regarding code practices, maintability, readability, efficiency etc

package cattledrive;

public class Times {
      public static void main(String[] args) {
            for(int i = 0; i < 11; i++){
                  for(int j = 0; j < 11; j++){
                        if(i == 0){
                              if(j == 0){
                                    System.out.format("%4s" , " ");
                                    continue;
                              }
                              else{
                                    System.out.format("%4d" , j - 1);
                                    continue;
                              }
                        }
                        else{
                              if(j == 0){
                                    System.out.format("%4d", i - 1);
                                    continue;
                              }
                        }
                        
                     System.out.format("%4d" , (i - 1)*(j - 1));
                  }
                  System.out.println();
            }
      }

}
SOLUTION
Avatar of mrjoltcola
mrjoltcola
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial