Ok so I'm doing one of those "Teach yourself VB" type books. And at the end there are practice exams and practice programs to write. The web is the only place I have to ask questions or check my code..etc. Well so far things are going great and I was feeling fairly confident. Now after reading my last chapter I ran into another practice program to write. The chapter was entirely on console applications. However none of the reading showed me how to go about such a program. Trust me, books are hard. I look at source all day and it truly helps but reading then doing is sometimes difficult. I've never done a console app in VB and I'm truly stuck on how to do this.
So the user can enter ANY odd number. I know I'm going to have to figure out how to check if the number is odd. And then figure out how to do a loop to add 2 to each asterisk and then subtract 2 as well. I also know I have to figure out the spacing for each one so the asterisk starts in the right place as well. I have no idea how to tackle this.
VB.NET:
Write a Console Application that uses nested for loops to draw a diamond pattern of asterisks (see below).
Have your program prompt the user for any odd number and then displays the corresponding diamond shape as shown below:
Example: If the user inputs 3:
*
***
*
Example: If the user inputs 5:
*
***
*****
***
*
So the user can enter ANY odd number. I know I'm going to have to figure out how to check if the number is odd. And then figure out how to do a loop to add 2 to each asterisk and then subtract 2 as well. I also know I have to figure out the spacing for each one so the asterisk starts in the right place as well. I have no idea how to tackle this.