Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

PROBLEM # 1:

Write a program that prints all the numbers from 0 to 29 that are not divisible by 6. Use a
continue statement to implement your program.

PROBLEM # 2:

Write a program that makes use of nested for loops to print the following pattern.

Now modify your code and take input from the user as to how many asterisks (*) to place in
each row and how many rows to draw. Also ask the user which character he would like to print
in place of the asterisk (*). The new output may look like the following.

Again modify your code so that the user can run your program again and again until the user
does not enter q or Q character to quit the program.

PROBLEM # 3

Write a program that takes a number (N) from the user and prints all the prime numbers
between 0 N. Try to use break statement in your program.
PROBLEM # 4

Make a program that should draw an inverted pyramid up to a user-defined limit. Ask user if
another pyramid needs to be drawn. Then keep a track of the number of times pyramid is
made? You must use for loop to implement the logic.

Example:

You might also like