Question
Write a console C# program to do the following: 1. Ask user max number of characters. This should be an odd number if user enters
Write a console C# program to do the following:
1. Ask user max number of characters. This should be an odd number if user enters even number add 1 to it to convert it to odd number.
2. Ask user the character to print
3. Your program should then output two inverted vertical triangles of base equal to number entered in #1 and made of characters in #2
4. Number of characters in one line of the triangle should differ by 2 from its next line such that the top of the triangle has only 1 character.
5. The top of the triangle (single character) should be centralized appropriately Make sure your code follows these guidelines The output string should be returned as a single string variable from a class Class should have a public function that will returns the string and takes the input for #1 and #2 as argument Code should be well commented and indented Check for all invalid input values (e.g. for #1 no character should be accepted). Suitable message should be displayed to user for incorrect input All 5 requirements should be met Code should compile and run without any error or warnings
Example: If user enters 9 for #1 and enters the character * for #2 the program should print the following:
* *** ***** ******* ********* ********* ******* ***** *** *
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started