Loops n for loop n Nested for loop
- Slides: 26
Loops n for loop n Nested for loop
Example: A tomato trader used to go to the whole sale market every day. If the price of the tomato box is less than SR 5, he would buy 200 boxes; otherwise he would buys 100 boxes. Write a MATLAB program that accepts the tomato’s prices for 30 days and then computes the following: n q q The number of boxes that the trader would buy during the 30 days. The total price of the tomatoes.
Example:
Example:
Example n Write a MATLAB function to create a special nxn matrix that has ones in the first row and first column, and whose remaining elements are the sum of two elements, the element above and the element to the left, if the sum is less than 20. Otherwise, the element is the maximum of those two elements.
Example:
Example: n The maximum height of an object thrown at angle θ is given by the Newton’s law as a function of the angle θ and the initial speed v: n Create a table showing the maximum height for the following values of v and θ v = 10, 12, 14, 16, 18, 20 θ = 50°, 60°, 70°, 80° n n
Example:
Example:
Example: n Three types of products require four manufacturing processes to be produced as shown in the following table: Hours required to produce one unit Process Hourly cost Product 1 Product 2 Product 3 1 10 6 5 4 2 12 2 3 14 3 2 5 4 9 4 0 3
Example: n n n Determine the cost of each process to produce one unit of product 1 Determine the cost to make one unit of each product Compute the total cost of producing 10 units of product 1, 5 units of product 2, and 7 units of product 3.
Example
while loop
Example n Write a MATLAB program to approximate the following so that the relative difference is less than 1%:
Example: n Write a MATLAB function that accepts an integer number x and returns the sum of its digits.
Example n Write a function called prime to compute the prime factors of an integer k.
The switch statement n An alternative for the if statement
Example
Example: n Use the switch statement to compute the total elapsed days in a year given the number of the month, the day, the year. - 1
Example:
Strings and Conditional Statements n A string is a variable that contains characters.
Strings and Conditional Statements
Strings and Conditional Statements
Strings and Conditional Statements
The break and the fprintf statements
The break and the fprintf statements
- Is nested loops bad
- Nested loops oracle
- Lesson 13 bee nested loops
- Nested loops java
- What is the output of the following nested loop
- Space complexity vs time complexity
- Break in python nested loop
- Pseudocode for loop example
- Nested loops storytelling
- Nested loops python
- N nested for loops
- Break statement matlab
- Data types in database
- Nested loop in assembly language
- Nested for loop
- Nested for loop flowchart
- Pascal looping
- Pseudocode repetition
- Statement perulangan
- What is nested loop
- Algoritma nested loop
- Index nested loop join
- Flowchart nested loop
- Nested for loop
- Block nested loop join cost
- Contoh soal nested loop
- Perulangan bersarang c++