Robotics C++ Physics II AP Physics B Electronics Java Astronomy Other Courses Summer Session  

Exercises

 

Exercise 1: Stars

Exercise 2: Prime Numbers

 

 

Exercise 1: Stars

 

This exercise is a Console Application

 

Part a

 

Prompt the user to enter the number of rows and columns

Draw a rectangle similar to the following if, for example, the user enters 4 rows and 5 columns

 

* * * * *

* * * * *

* * * * *

* * * * *

 

Part b

 

Prompt the user to enter the number of rows

Draw a triangle similar to the following if, for example, the user enters 5 for the number of rows

 

* * * * *

* * * *

* * *

* *

*

 

Part c

 

Prompt the user to enter the number of rows

Draw a shape similar to the following if, for example, the user enters 5 rows

 

*

* *

* * *

* *

*

 

Exercise 2: Prime Numbers

 

Find and print, appropriately labeled, the prime numbers between 1 and 100, 5 per line