Math in Linux (Possible Error in the question)

  • Thread starter Thread starter Moonshine2183
  • Start date Start date
M

Moonshine2183

So maybe this is an odd question maybe not.

I have a super simple program that will allow a user to input two numbers, and then the program will give the product of the two numbers.

echo "Enter 2 numbers"
read x
read y
let c=$x*$y
echo "The product of $x and $y is: $c"

My question is could I do the same thing my program above does with either case, while, until, or for loops?

The reason I ask is because I'm trying to answer a lab question that asks me to write a short program that will allow a user to input two numbers, and then the program will give the product of the two numbers. (Which the above program does)

But the lab also said at the beginning using your knowledge of the Case, While, Until, and For Loop write programs to satisfy the questions below.

I understand how to use case, while, until, and for loops (at least basically) and there use doesn't seem to make sense in the context of what the question is asking.

Is this question maybe the exception to the rule in my lab or am I missing something?

Thoughts please

Continue reading...
 
Back
Top