Skip to content

Instantly share code, notes, and snippets.

@isobarbaric
Created October 18, 2022 00:20
Show Gist options
  • Select an option

  • Save isobarbaric/c1bddb01f1fd38f88b97f711bef65376 to your computer and use it in GitHub Desktop.

Select an option

Save isobarbaric/c1bddb01f1fd38f88b97f711bef65376 to your computer and use it in GitHub Desktop.
Java Solution - CS Problem of the Week #1 (2022-2023)
/*
* Avinash Anand
* October 17, 2022
* This program will print out the times table from 1 to 12, and the if statements format the table.
*/
package cssolution1;
public class Cssolution1 {
public static void main(String[] args) {
int num = 0;
for(int i = 1; i <= 12; i++){
for(int j = 1; j <= 12; j++){
num = i * j;
if(num < 10){
System.out.print(num + " ");
} else if(num >= 10 && num < 100){
System.out.print(num + " ");
} else if(num >= 100){
System.out.print(num + " ");
}
}
System.out.println();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment