Question

Write a bash shell Script to look like this using C-style nest for loop.      |   1...

Write a bash shell Script to look like this using C-style nest for loop.

     |   1    2    3    4    5    6    7    8    9   10   11   12

-----+------------------------------------------------------------

  1 |   1    2   3    4    5    6    7    8    9   10   11   12

  2 |   2    4   6    8   10   12   14   16   18   20   22   24

  3 |   3    6   9   12   15   18   21   24   27   30   33   36

  4 |   4    8 12   16   20   24   28   32   36   40   44   48

  5 |   5   10 15   20   25   30   35   40   45   50   55   60

  6 |   6   12 18   24   30   36   42   48   54   60   66   72

  7 |   7   14 21   28   35   42   49   56   63   70   77   84

  8 |   8   16 24   32   40   48   56   64   72   80   88   96

  9 |   9   18 27   36   45   54   63   72   81   90   99 108

10 | 10   20   30 40   50   60   70   80   90 100 110 120

11 | 11   22   33 44   55   66   77 88   99 110 121 132

12 | 12   24   36 48   60   72   84   96 108 120 132 144

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

NOTE: I have completed answers for your question along with explanation. Please check and let me know if you have any questions. I will revert back within 24 hours. Thanks for your patience.

Code:

#!/bin/bash

# printing the header row
echo -n " |"
for i in {1..12}
do
   echo -n "$i "
done

# printing the header line
echo
for i in {1..12}
do
   echo -n "-----"
done
echo

# printing the multiple table
for i in {1..12}
do
   echo -n $i " | "
   for j in {1..12}
   do
       # calculating the multiplication of numbers here
       echo -n `expr $i \* $j` " "
   done
   echo
done

Code output screenshot:

Add a comment
Know the answer?
Add Answer to:
Write a bash shell Script to look like this using C-style nest for loop.      |   1...
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
  • Note: The assignment must be submitted into the designated link in the Blackboard cou page. You...

    Note: The assignment must be submitted into the designated link in the Blackboard cou page. You are to save each HTML5 document file as the following synt StudentID FirstName_LastName Question Number ► QUESTIONS In this assignment you are required to write HTML5 code which contains JavaScript in order to do the following tasks: 1) Construct the below multiplication table using JavaScript code and HTML5 1 2 3 4 5 6 7 8 9 10 11 12 111 2 3 4...

  • NB: All C programs should be compiled using C Compiler application. The code should be shown...

    NB: All C programs should be compiled using C Compiler application. The code should be shown on the document. A screen shot of the running program given as output on the assignment. a). Describe the types of arrays and operations that can be performed of them. [10] b). Write a program to print the multiplication table from 1*1 to 12*10. [10] Example MULTIPLICATION TABLE 1 2 3 4 5 6 7 8 9 10 2 4 6 8 10 12...

  • Python pleases! Write a program that will produce the following table below. You will use a...

    Python pleases! Write a program that will produce the following table below. You will use a nested for loop and a duplicate nested while loop in one program. Note that this is the one through twelve multiplication table. Write the flowchart for the program. X 1 2 3 4 5 6 7 8 9 10 11 12 1 1 2 3 4 5 6 7 8 9 10 11 12 2 2 4 6 8 10 12 14 16 18...

  • in Java programming Using IF statement, write a program that prints multiplication table for 1-10. Sample...

    in Java programming Using IF statement, write a program that prints multiplication table for 1-10. Sample Program Output. 1     2     3     4     5     6     7     8     9     10       1     1     2     3     4     5     6     7     8     9     10       2     2     4     6     8     10    12    14    16    18    20       3     3     6     9     12    15    18    21    24    27    30       4     4     8     12    16    20    24    28    32    36    40       5     5     10   ...

  • Problem-2 A very thin, uniformly-charged rod with total charge Q and length 2L lies along the...

    Problem-2 A very thin, uniformly-charged rod with total charge Q and length 2L lies along the vertical 2-axis. Sitting still (zero velocity and zero acceleration) at a distance H above the top end of the rod is a proton. Gravity is acting on the proton in the downward (-2) direction. What is the the total charge Q on the rod? + profon K & de d = k l . dx. - EL - K Let =) , U, -...

  • Exercise 4 – Printing out 10 multiples per row Design a function called print_ten_multiples that takes...

    Exercise 4 – Printing out 10 multiples per row Design a function called print_ten_multiples that takes an integer as a parameter. The function should print out the first 10 multiples of all numbers from 1 up to the given number. The values printed should be formatted with "3d". Example: print(format(x, "3d")) Examples of how the function output should look with this formatting: print_ten_multiples(3): 1 2 3 4 5 6 7 8 9 10 2 4 6 8 10 12 14...

  • Write a program in C that stores the result of all multiplications between 1 and 9...

    Write a program in C that stores the result of all multiplications between 1 and 9 in a two-dimensional int array and then prints the contents of the array to the screen. Also, write some comments in the code. Example: Expected output: 1 4 6 7 8 8 1 12 14 16 18 4 3 6 9 12 15 18 21 24 27 4 8 12 16 20 24 28 32 36 5 1e 15 20 25 30 35 40...

  • Write a C program to assign natural numbers 1 to 100 into a one-dimensional integer array....

    Write a C program to assign natural numbers 1 to 100 into a one-dimensional integer array. Display all the values in the array on the screen. For each number in the array, determine if the number contains digit 7 or is divisible by 7. Display all those numbers on the screen. Original array: 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...

  • Write a python nested for loop that prints out the following pattern 100 99 98 97...

    Write a python nested for loop that prints out the following pattern 100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33...

  • For each variable of interest, do the following: 1. Find the mean, five-number summary, range, variance,...

    For each variable of interest, do the following: 1. Find the mean, five-number summary, range, variance, and standard deviation. Display these numbers in a format that is easy to understand. 2. For each variable of interest, use its five-number summary to construct a boxplot. Each boxplot must be constructed horizontally, and must be accompanied by a brief descriptive paragraph that assesses whether the data appear to be symmetrical, left-skewed, or right-skewed. Construct a 95% confidence interval for the mean μ...

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