The document discusses various programming concepts like loops, repetition, counting, and summarizing series. It provides examples of using loops and counters to calculate sums and display series. It also discusses different approaches of using a counter variable versus an additional variable to track changing values across loop repetitions.
2. Assignment-1 Solution Programming Fundamentals | Lecture-9 (m == 3 AND d >= 21) OR (m == 4 AND d <= 19) Period Meaning March 21 – April 19 If Month is 3 then Day must be 21 st or above Or if Month is 4 then Day must be 19 th or below
3. Wrong Decision Rules Programming Fundamentals | Lecture-9 m == 3 OR m == 4 m == 4 OR m == 5 DISPLAY “Aries”
4. Wrong Decision Rules Programming Fundamentals | Lecture-9 (m == 3 AND d >= 21 AND d <= 31) (m == 4 AND d >= 20 AND d <= 30)
5. Less Better Approach Programming Fundamentals | Lecture-9 m == 3 m == 4 Further rules
6.
7.
8.
9.
10.
11. Sum of first 5 even numbers Programming Fundamentals | Lecture-9 START sum = 0 count = count + 1 STOP count < 5 count = 0 DISPLAY sum Yes No sum = sum + count + count
12. Alternative Programming Fundamentals | Lecture-9 START sum = 0 count = count + 1 STOP count < 5 count = 0 DISPLAY sum Yes No sum = sum + even even = 0 even = even + 2
13.
14. Sum of first n odd numbers Programming Fundamentals | Lecture-9 START sum = 0 count = count + 1 STOP count < n count = 0 DISPLAY sum Yes No sum = sum + count + count - 1
15. Alternative Programming Fundamentals | Lecture-9 START sum = 0 count = count + 1 STOP count < 5 count = 0 DISPLAY sum Yes No sum = sum + odd odd = -1 odd = odd + 2
16.
17. Display first n even numbers Programming Fundamentals | Lecture-9 START count = count + 1 STOP count < 5 count = 0 Yes No DISPLAY even even = 0 even = even + 2
18.
19. Table of a number up to 10 Programming Fundamentals | Lecture-9 START count = count + 1 STOP count < 10 count = 0 Yes No DISPLAY num * count READ num
20.
21. Programming Fundamentals | Lecture-9 START sum = 0 count = count + 1 STOP count < 5 count = 0 DISPLAY sum Yes No sum = sum + count + 25