Jump to content

Math in Linux (Possible Error in the question)


Recommended Posts

Guest Moonshine2183
Posted

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...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...