Question 1 (60 points) Write a Matlab program that creates uses a 1 x 100 array of numbers and fills it with integers which count up from 1 to 50 and then down from 49 to 1 again (i.c., 1 2 3 4 47 48 49 50 49 48 47 4 3 2 1). It should display the array on the screen. ...
Question 2 (40 points) Write a Matlab program that starts with a total of zero and uses a WHILE loop to keep adding a random integer between -1 and +2 (i.e., either -1, 0, +1 or +2) to the total, until the total is greater than or equal to 100,000. The program should display the total as it runs and when finished tell the user how long it took to reach that total. Hint: one approach is for the program to stay in the WHILE loop while a variable called total hasn't been reached yet.
Question 1 (60 points) Write a Matlab program that creates uses a 1 x 100 array of numbers and fills it with integers wh
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am