Monday, August 14, 2017

Create pattern with "*" like as follows using While Loop in VB.NET.

Create pattern with "*" like as follows using  While Loop in VB.NET.

*                                              *                                                                 *
* *                                           * *                                                              * *
* * *                                        * * *                                                           * * *
                                                * * * *                                                        * * * *
                                                * * * * *                                                     * * * * *
In this post you will find one sample VB.NET console program which will print pattern like mentioned in the post using While Loop.

You will find same pattern solution using For Loop in my future post :

As you can see in post we need dynamic pattern so first we need to take user input to get number of cycle for this pattern output.

Once you have count you can use that count against While Loop to iterate your console output.

You will find 2 While Loop in this program. 1st Loop is required to perform number of iteration and with this loop only we will go to new line on console.

2nd while Loop is required to perform actual print of STAR ( * ).

Please find example and output of this VB.NET Program as mentioned.
Console Output :


Hope this simple program help any developers.

Please post your any questions or comments bellow on comment box. Thank You !                                                                                                           

No comments:

Post a Comment