Question
Given the following script, answer questions that follow: echo Please enter 1st integer: read n1 echo Please read 2ndinteger: read n2 echo Please
Given the following script, answer questions that follow:
echo "Please enter 1st integer: "
read n1
echo "Please read 2ndinteger: "
read n2
echo "Please read the 3rd integers: "
read n3
# Finding the MIDDLE number among the 3 numbers
##### Q2: CODE WILL BE HERE
The Questions:
1. How to show the messages and read the numbers in the same line? Write any of the reading echo commands to read the variable in the same line with the echo output (2 pts)
2. Write the missing code to find the Middle number among the three read numbers. For example, middle of 20, 10, 50 is 20. Middle of 12, 10, 20 is 12 (5 Pts)
3. Is it possible to make the read numbers read only variables? Explain your answer with explaining what is read only variables (3 pts)
4. Define the variable avg that will store the average of the three read numbers and initialize it to any value you like (2 Marks)
5. Can I calculate the average of the three read numbers? If yes write the command. If no, explain why (3 Marks)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started