0% found this document useful (0 votes)
6 views

ECE201 - Lab Sheet 10 (2) 2

Uploaded by

randalnahed00
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views

ECE201 - Lab Sheet 10 (2) 2

Uploaded by

randalnahed00
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Electrical Engineering Department ‫قسم الهندسة الكهربائية‬

Course Programming Applications for Engineers (ECE 201)


Name ‫هيفاء‬ ‫رند‬
Lab 10 Class
sheet no.

1. Write a MATLAB program to find the average of ten students’ marks by using
for loop.
Steps:
1. Start by defining an array named marks with 10 elements, each representing a student's mark.
2. Use a for loop to go through each student's mark in the array.
3. After the loop, calculate the average.
4. Finally, display the average using the fprintf function with two decimal places.

Code:

Output:
Electrical Engineering Department ‫قسم الهندسة الكهربائية‬

2. Write a MATLAB function to find the value of x for following:

Function code:

Main script code:

Output:
Electrical Engineering Department ‫قسم الهندسة الكهربائية‬

3. Write a MATLAB function to find the perimeter and area of a rectangle.

Function code:

Main script code:

Output:

You might also like