Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In Java 1. Write a program that prompts the user for a positive integer . If the user does not enter a positive integer, keep

In Java

1. Write a program that prompts the user for a positive integer. If the user does not enter a positive integer, keep prompting them (using a WHILE loop) until they enter proper input (so, for example, if they enter -5, it should re-prompt because the value is not positive).

Once the user has entered a positive integer, n, use a FOR loop to output the factorial of n.

Recall, n! = n * (n-1) * (n-2) * ... * 3 * 2 * 1.

2. Write a program that prompts two positive integers m, n from the

console and outputs a multiplication table of the size m x n.

For each row: Print each row with a header of the row number, tab, |, and tab. Print each row with the row number times column number, followed by tab. (Use another for loop). Finally print a new line.

Print Header row: *, tab, |, column umber, tab, column number, tab ..., newline Print s. Hint: Use tabs. Each tab is 8 spaces, so you need to write eight -.

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

Spatial Databases With Application To GIS

Authors: Philippe Rigaux, Michel Scholl, Agnès Voisard

1st Edition

1558605886, 978-1558605886

More Books

Students also viewed these Databases questions

Question

How do Excel Pivot Tables handle data from non OLAP databases?

Answered: 1 week ago