-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathL3L4B.java
37 lines (30 loc) · 1.1 KB
/
L3L4B.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
//Ranye Mclendon
//EEGR 409
//Lecture 3 Lab 4B
//02/17/2022
//This is a program calculates a table of sqaures printing all values to the right of the diagonals of the table using continue statement
import java.io.*;
import java.util.Scanner;
public class L3L4B {
public static void main (String[] args) throws IOException{
//declare variable
int N, row, col;
//ask user for dimension for the table
Scanner in = new Scanner(System.in);
System.out.print("Enter the dimension of the square table: ");
N = in.nextInt();
//calculate a table of squares by looping from 0 to N
for (row = 1; row <= 5; row++){
for(col = 1; col <= N; col++){
//display the table with N and squared N
if ( col >= row){
System.out.print((row * col) +"\t");
}
else{
System.out.print("\t");
}
}
System.out.print("\n");
}
}
}