Skip to content

Latest commit

 

History

History
6 lines (6 loc) · 609 Bytes

student_example1.md

File metadata and controls

6 lines (6 loc) · 609 Bytes

In-Class Example 1

Ok, so let us have you practice some programming flow control. I would like you to create a simple script (.m file is fine) that will do the following:

  • Make a loop that will execute twenty times
  • Each time in the loop, create a single random number. I suggest you use the randn function
  • Test to see if your random number is positive or negative
  • Print out a statement to the command window that both gives the number and then states whether it is positive or negative. For example, you could print out (assuming your number is -1.23) the statement 'The number -1.23 is negative.'