SarthakKeshari / CPP-Questions-and-Solutions

This repository aims to solve and create new problems from different spheres of coding. A path to help students to get access to solutions and discuss their doubts.
MIT License
47 stars 132 forks source link

Print Letter V #338 #393

Closed saurabh042 closed 2 years ago

saurabh042 commented 2 years ago

Issue Id you have worked upon -

338 CPP Program to print pattern of Letter 'V'

Briefly explain your program logic -

The entire pattern can be considered as a 2D array, where each row has @@ and whitespaces. There is a pattern in the number of whitespaces each row has at the beginning, middle and at the end which is dependent on the row number. In my implementation, I have established this relation and printing character string based on that.

Screenshots(Attach 2 screenshots of your own input and output) -

As per the issue requirement, I have hard coded the level = 7 to generate exact output required. This can be taken as user input as well in the variable level Output screenshot: image


Checklist:

Eg - If your code follow the below guidelines. Kindly change [] to [x]

All the conditions should be fulfilled for considering your code for merging -