Loops
Overview:
In this assignment, you will write a program that performs multiple tasks involving number patterns, character patterns, and
simple logic puzzles. Each task should be implemented using a specific type of loop or combination of loops.
Write a program that:
Part 1: Counting and Summing (For Loop)
Asks the user for two integers: a starting number and an ending number.
• Uses a for loop to print all the numbers from start to end (inclusive).
• Calculates and displays the sum of all even numbers in that range.
Part 2: Guess the Number (While Loop)
Generate a random number between 1 and 100.
• Ask the user to guess the number.
• Use a while loop to keep prompting the user until they guess correctly.
Give hints like "Too high" or "Too low" after each guess.
Part 3: Password Retry (Do-While Loop)
• Set a hardcoded password (eg, "CSisFun")
• Ask the user to enter the password.
• Use a do while loop to keep asking until the correct password is entered.
Part 4: Pattern Printing (Nested Loops)
I
Write a program that prints the following patterns using nested loops. Ask the user for the number of rows (n) to
print
•Pattern A: Right-angled Triangle