Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: daixieit

COEN 243

Lab Exercice 4

Question: Today you are to write a C++ program that asks the user to enter a positive number (of type integer) that is a multiple of 3. If the user enters an integer that is not a multiple of 3, the program should continue prompting for a new number until the user enters the correct input.  Then with the use of loops and nested loops you are supposed to produce a specific triangle pattern as illustrated in the figures below.

There must be a tab between each number.  Be sure to use the same format as in the sample runs in the table below. Your code must work no matter what number the user enters.

The box below illustrates how your program should behave and appear.

Enter a number that is a multiple of 3: 5¿

Enter a number that is a multiple of 3: 7¿

Enter a number that is a multiple of 3: 12¿

 

12      9       6       3

9       6       3

6       3

3

Enter a number that is a multiple of 3:6¿

6       3

3

Enter a number that is a multiple of 3:7¿

Enter a number that is a multiple of 3:9¿

 

9       6       3

6       3

3

 

Note 1: Assume the user always enters positive values of type integer (You do not need to check the negative and floating-point numbers).