3.3 Task Three Write a function with the purpose of printing the following patterns on the screen. It has a head as void prin

3.3 Task Three Write a function with the purpose of printing the following patterns on the screen. It has a head as void print_pattern(int n), where n specifies the number of lines you want to put on the screen. When it is called in the main function as shown in the following, it generates the following pattern on the screen. in C++ void print_pattern(int n); int main() int n; cout<<“How many numbers you like to print on the screen ?”; cin>>n; print_pattern(n); return 0; Output How many numbers you like to print on the screen ?6 1 2 2 2 3 3 3 3 3 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 6 6 6 6 6 6 6 6 6 6 6 Requirement: complete the function definition and a main to call this function verify that your function really performs the task.



Source link

Leave a Reply

Your email address will not be published. Required fields are marked *