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();
}
}
}
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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.