Lab 1
Lab 1
Write the required C and/or Matlab programs for each of the following problems. Compile
and execute the programs. Copy and paste the outputs into an .doc/.docx file. Upload all
original program files and the output document to Canvas.
Required:
1. Include comments in your code giving your name, the date, a code description, and
the problem number.
2. Whenever printing a value to the screen, also print a statement defining the value and
any units. Example: Do “the distance x is 23 meters”; Don’t “23”.
Problem 1 [10]
Write C and Matlab programs that print to the screen three sentences of your choosing. The
sentences must be double spaced when printed.
Problem 2 [35]
Write C and Matlab programs that compute the following quantities and prints each of them
to the screen on separate lines:
• 4cos(11)
−2
• tan−1 ( ) Note: use the function atan2(y,x) for four-quadrant inverse tangent
0
• 212 Note: in C, use the function pow(x,y)
Problem 3 [20]
Write a C program that asks for your height in inches and prints your height in meters.
Problem 4 [35]
Write a C program that accepts inputs for floating numbers ω, t, and φ. Use these quantities
to calculate and print to the screen this quantity:
A = 6sin(ωt + φ)