You are on page 1of 2

UNIVERSITY OF ENGINEERING AND TECHNOLOGY, TAXILA

FACULTY OF TELECOMMUNICATION AND INFORMATION ENGINEERING


COMPUTER ENGINEERING DEPARTMENT

Computer Application in Engineering Design


Lab Manual No 04
Conditional Statements and Loops in MATLAB

Dated:
28th November, 2016 to 02nd December, 2016

Semester:
Autumn 2016

Computer Application in Engineering Design


Session:-2015 Computer

Lab Instructor:-Engr. Aamir Arsalan

UNIVERSITY OF ENGINEERING AND TECHNOLOGY, TAXILA


FACULTY OF TELECOMMUNICATION AND INFORMATION ENGINEERING
COMPUTER ENGINEERING DEPARTMENT

Lab Tasks:1. Write a MATLAB code to find the prime numbers from 1 to
100.
2. Generate a random vector of 100 numbers ranging from 1 to
200. Write a MATLAB code to find the numbers which are
multiple of 2 and 3. Create separate vectors for multiple
of 2 and 3.
3. Write a function named assign_grade that: takes 1 argument,
a number score. returns a grade for the score, either "A",
"B", "C", "D", or "F".
4. Write a program to convert an integer number into its
equivalent binary number.
5. Write a program to find out the factorial of an integer.
6. Write a program to calculate the sum of the first 10 odd
numbers and first 10 even numbers.
7. Write a program to calculate the square and cube of first
ten even numbers.
8. Write a program to compute the average grade of each
student in a class of 20 students. Each student has taken
four exams during the semester. The final grade is
calculated as the average of these exam grades. The program
should display the average grade of the student. Use nested
loops.

Computer Application in Engineering Design


Session:-2015 Computer

Lab Instructor:-Engr. Aamir Arsalan

You might also like