Question

(AdditionTable.java) Write a program that displays the following addition table. Notes: You must use a nested...

(AdditionTable.java) Write a program that displays the following addition table.

Notes: You must use a nested loop. There are spaces at the beginning of each row.

Homework Answers

Answer #1
public class AdditionTable {
    public static void main(String[] args) {
        int n = 9;

        for(int i = 1;i<=n;i++){
            for(int j = 1;j<=n;j++){
                System.out.println(i+" + "+j+" = "+(i+j));
            }
        }
    }
}

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
(SubtractionTable.java) Write a program that displays the following subtraction table. Notes: You must use a nested...
(SubtractionTable.java) Write a program that displays the following subtraction table. Notes: You must use a nested loop. There are spaces at the beginning of each row.                                                                                                                 2 - 1 = 1                                                                                                   3 - 1 = 2   3 - 2 = 1                                                                                   4 - 1 = 3   4 - 2 = 2   4 - 3 = 1                                                                   5 - 1 = 4   5 - 2 = 3   5 - 3 = 2   5 - 4 = 1  ...
write Java code FAMOUS QUOTES PROGRAM - Write a program that displays the following information in...
write Java code FAMOUS QUOTES PROGRAM - Write a program that displays the following information in the EXACT pattern/formatting shown below. You must use escape sequences to do this - this is not English class and things are written below to test you on escape sequences form class, so no matter what follow the pattern/formatting shown (the dashes and spaces do not have to be perfect but everything else should match, you should try to use tabs for the spacing...
Write a Java program using a single multi-level nested for-loop to display the following pattern (For...
Write a Java program using a single multi-level nested for-loop to display the following pattern (For each iteration, only one character can be printed) : 1,2,3,4,5,6,7,8,9#1,2,3,4,5,6,7,8,9#1,2,3,4,5,6,7,8,9# 3,6,9,12,15,18,21,24,27#3,6,9,12,15,18,21,24,27#3,6,9,12,15,18,21,24,27# 5,10,15,20,25,30,35,40,45#5,10,15,20,25,30,35,40,45#5,10,15,20,25,30,35,40,45#
Question: Write a C++ program to ask the user to give you the number of rows...
Question: Write a C++ program to ask the user to give you the number of rows and number of columns, then make the multiplication table by using nested loop. For example, if the user enters 3 for rows and 4 for columns then the multiplication table would be like the following: 1    2   3     4 1   1 2 3 4 2   2    4      6    8 3    3 6 9 12
Write a Java program that reads words from a text file and displays all the words...
Write a Java program that reads words from a text file and displays all the words (duplicates allowed) in ascending alphabetical order. The words must start with a letter. 1. You must use one of following Concrete class to store data from the input.txt file. Vector, Stack, ArrayList, LinkedList 2. To sort those words, you should use one of existing interface methods available in Collection or List class.
Design a program in Java that displays all of the prime numbers from 1 through 100....
Design a program in Java that displays all of the prime numbers from 1 through 100. The program should have a loop that calls the isPrime() function. 11 Prime Numbers List (15 points) Use CONSTANTS to set the maximum number in the table to 100 and the number of entries per row to 5.   Table of prime numbers from 1 to 100 1 2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59...
Python Code Use (for loops) inside another for loop (a nested loop) to do the following:...
Python Code Use (for loops) inside another for loop (a nested loop) to do the following: Print Hello 30 times followed by Bye 10 times. Do that whole thing 15 times. (for a total of 600 lines of output) #Hint: First write the code that prints 30 "Hello" and then 10 "Bye". Think of that as two separate tasks, each of which requires its own for loop. THEN, once you get that working, put all of that inside ANOTHER loop...
In Java. Write a program that reads-in a times table-number. The program, using this table-number will...
In Java. Write a program that reads-in a times table-number. The program, using this table-number will produce the following report (as shown). The first item in the report is a number with starting value 1. Second column is the word “ X ” (representing the times symbol). Third column is the table-number (itself). Following is an equal sign “ = “ (representing a result). Last column is the result of the operation for that line or row which is the...
Assignment #4 – Student Ranking : In this assignment you are going to write a program...
Assignment #4 – Student Ranking : In this assignment you are going to write a program that ask user number of students in a class and their names. Number of students are limited to 100 maximum. Then, it will ask for 3 test scores of each student. The program will calculate the average of test scores for each student and display with their names. Then, it will sort the averages in descending order and display the sorted list with students’...
(1) Ask the user to input a character. You will draw your right triangle with this...
(1) Ask the user to input a character. You will draw your right triangle with this character. (2) Ask the user to input the number of rows (integer). This will also signify the number of characters at the base of the triangle. (3) Use a nested loop to draw the triangle. The first line will only have one character but will now need to output enough spaces such that the character is output at the end of the row instead...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT