Question

Java Script program to print the five times table from 1 to 12

Java Script program to print the five times table from 1 to 12

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Please find the code belowwith detailed inline comments.

CODE

=======================

<html>
<body>
<p id = "demo"></p>
<script>
// this function is used to print five times table from 1 to 12
function printTable() {
var res = "Table of 5 <br>";
res += "======== <br>"
// loop from 1 to 12
for(let i=1; i<=12; i++){
// print the multiplcation value
res += "5 x " + i + " = " + 5*i + "<br>"
}
document.getElementById("demo").innerHTML = res;
}

printTable();

</script>
</body>
</html>

OUTPUT

=======================

9 6 5 10 15 20 25 30 35 40 0555 44 5 ple- 123456789111 T-| 5 5 5 5 5 5 5 5 5 5 5 5

Add a comment
Know the answer?
Add Answer to:
Java Script program to print the five times table from 1 to 12
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. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • I need a java program that print the first and last numbers from 12 to 19...

    I need a java program that print the first and last numbers from 12 to 19 using Keyboard

  • Java Submit a program in a .java file. The program should print a multiplication table for...

    Java Submit a program in a .java file. The program should print a multiplication table for the numbers 1-9. This requires a nested for loop. The outer loop moves from row to row, while the inner loop prints the row. Use tabs to separate the output, such as in the following statement:      System.out.println(“1\t2\t3\t4\t5\t6\t7\t8\t9”); Output should look similar to the following. 1      2     3     4     5     6     7     8     9 ------------------------------------------------------------------ 1       2     3     4     5     6        7     8     9...

  • Write a Java program that uses nested for loops to print a multiplication table as shown...

    Write a Java program that uses nested for loops to print a multiplication table as shown below. Make sure to include the table headings and separators as shown. The values in the body of the table should be computed using the values in the heading e.g. row 1 column 3 is 1 times 3. * | 1 2 3 4 5 6 7 8 9 4 | 1| 1 2 3 456 7 8 9 2 | 2 4 6.8...

  • Write a script that works in vim: We are given a Java program RandomTest.java that generates...

    Write a script that works in vim: We are given a Java program RandomTest.java that generates specified number of random integers in the range [0...99]. The program prints FAIL if either 0 or 99 is generated (along with a count of how many times). Otherwise it prints PASS. The program takes the number of random integers to generate as a command line argument as shown below. Note that the given results each time is is run. [an@localhost ~] java Random...

  • Write a Java program in Eclipse. . Write a Java program that: 1. Creates an array...

    Write a Java program in Eclipse. . Write a Java program that: 1. Creates an array of 100 integers. Initialize the array to have all zeros. 2. Puts even numbers starting from 6 (excluding multiples of 12) into the first 50 slots of the array above. So numbers 6,8,10,14,16,18,20,22,26, etc. go into the first 50 positions in the array. Print the array. 3. Puts random numbers between 45 and 55 into the second 50 slots of the array above (second...

  • Write a Unix Shell Script to print all Armstrong Numbers between 1 and 1000. Your Program...

    Write a Unix Shell Script to print all Armstrong Numbers between 1 and 1000. Your Program should include following key points: Program should have Header Comments. Program should print all Armstrong numbers between 1 and 1000: 1 153 370 371 407

  • In C: Write a program that will compute and print a table of the factorials from...

    In C: Write a program that will compute and print a table of the factorials from 1 to 12. The program should define a function called fact to compute the factorial, use loops where appropriate, and produce the following output: 1 1 2 2 3 6 4 24 5 120 6 720 7 5040 8 40320 9 362880 10 3628800 11 39916800 12 479001600

  • Write a java program that will print if n numbers that the user will input are...

    Write a java program that will print if n numbers that the user will input are or not within a range of numbers. For that, your program needs to ask first for an integer number called N that will represent the number of times that will ask for other integer numbers. Right after, it should ask for two numbers that will represent the Min and Max for a range. Lastly. it will iterate N number times asking for an integer...

  • Program specification You and your partner must write a Java program to print a simple black...

    Program specification You and your partner must write a Java program to print a simple black and white excerpt of the periodic table of elements. First you should obtain the following information from the user: whether the 'Lanthanum, group (elements 57-71) and Άctinium, group (elements 89-103) should be printed-the default is no; the atomic number of the first element to display 118 is given; and the default is 1 and should be used whenever a value less than 1 or...

  • Need Java help: 1. Create a Java program that accepts input String input from a user...

    Need Java help: 1. Create a Java program that accepts input String input from a user of first name. 2. Create a Java program that accepts input String input from a user of last name. 3. Concatenate the Strings in a full name variable and print to the console.

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT