CSE 1062 Fundamentals of Programming Lecture #8: Spring 2017
CSE 1062 Fundamentals of Programming Lecture #8: Spring 2017
CSE 1062 Fundamentals of Programming Lecture #8: Spring 2017
Lecture #8
Spring 2017
2
Loop Programming Techniques ASTU
3
Interactive Input within a Loop ASTU
4
Selection in a Loop ASTU
5
Evaluating Functions of One Variable ASTU
6
Loop Programming Techniques ASTU
7
Interactive Loop Control ASTU
8
Random Number and Simulation ASTU
• Example #1
9
Random Number and Simulation ASTU
10
Random Number and Simulation ASTU
11
Random Number and Simulation ASTU
12
Practice if statements ASTU
13
General Math and Science Problems ASTU
15
General Math and Science Problems ASTU
17
Assignment #2: Heat Transfer ASTU
18
Assignment #2: Heat Transfer ASTU
19
Assignment #2: Heat Transfer ASTU
21
Drawing Patterns with Nested For Loops ASTU
22
Recursion vs. Iteration(Loops) ASTU
23
Recursion vs. Iteration(Loops) ASTU
24
Factorial: Using Recursion ASTU
25
Factorial: Using Recursion ASTU
Fact(5) 120
5* Fact(4) 24
4* Fact(3) 6
3* Fact(2) 2
2* Fact(1) 1
Factorial: Using Iteration ASTU
27
Fibonacci Numbers ASTU
Fibonacci numbers
n f(n)
1 if n = 0 0 1
1 if n = 1 base case 1 1
f(n)
f(n – 1) + f(n - 2) recursive case 2 2
3 3
4 5
5 8
6 13
…… ……
28
Fibonacci Numbers ASTU
Fib(5) 8
Fib(4) 5 Fib(3) 3
2 Fib(2) 1 1 1 1 1
1 1
Fibonacci Numbers ASTU
30
Solving Trigonometry using Series ASTU
31
General Math and Science Problems ASTU
33