Homework #1

All problems must be in a single *.m file. Make a separate block in the code for each problem.

Contents

Problem 1

Use 'fprintf' to print your name followed by a carriage return to the command line.

Problem 2

Create a 10x1 sized array named 'A'. Use a for loop to assign the numbers 1 through 10 into array. Suppress the output during the for loop. At the end show the contents of 'A'. It should look like:

A =

     1
     2
     3
     4
     5
     6
     7
     8
     9
    10

Problem 3

Use a 'for' loop and an 'if' statement to count how many even numbers there are in the variable 'A' that you created in Problem 2. Hint: use 'floor'

Problem 4

Use a 'while' loop and an 'if' statement to build an array of the first 10 odd numbers.