Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

CSCI - 2 4 6 7 Lab 4 Loops Assignment Write a program to print a multiplication table. First ask the user for the size

CSCI-2467 Lab 4 Loops
Assignment
Write a program to print a multiplication table. First ask the user for the size of the table. Then print a multiplication
table (with a range of 1 to the specified size). For instance, if the user specified a size of 4, the program would print:
1*1=11*2=21*3=31*4=4
2*1=22*2=42*3=62*4=8
3*1=33*2=63*3=93*4=12
4*1=44*2=84*3=124*4=16
Each arithmetic equation should be followed by two spaces. To implement the program, you will need to use a loop
within a loop (nested loops). You may use either two for or two while loops.
Use the following code as a starting point for your assignment:
import java.util.Scanner;
// TODO Add student name, date, purpose of program
public class Main {
public static void main(String[] args){
Scanner input = new Scanner(System.in);
// TODO add your code here
}
}
As always include a comment with your name, the date, and the purpose of the program.
Example Output
Enter size of multiplication table: 3
1*1=11*2=21*3=3
2*1=22*2=42*3=6
3*1=33*2=63*3=9
Process finished with exit code 0
More Example Output
Enter size of multiplication table: 6
1*1=11*2=21*3=31*4=41*5=51*6=6
2*1=22*2=42*3=62*4=82*5=102*6=12
3*1=33*2=63*3=93*4=123*5=153*6=18
4*1=44*2=84*3=124*4=164*5=204*6=24
5*1=55*2=105*3=155*4=205*5=255*6=30
6*1=66*2=126*3=186*4=246*5=306*6=36
Process finished with exit code 0

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

c. What were you expected to do when you grew up?

Answered: 1 week ago

Question

4. Describe how cultural values influence communication.

Answered: 1 week ago

Question

3. Identify and describe nine cultural value orientations.

Answered: 1 week ago