Q:

C++ Program To Print A Given Reverse STAR Pattern

0

Write A C++ Program To  Print A Given Reverse STAR Pattern Using As-trick ( * ) .


                                      ***********
                                        *********
                                          *******
                                            *****
                                             ***
                                               *

Logic :- 

For Printing any pattern remember always use For loop .In mostly pattern two for loops require first loop for Row and second for Column .May Be in your pattern for loop can be use parallel or Nested according to pattern you have to use if you don't know about how to print pattern then i refer first print this pattern by Own

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

#include<iostream>
using namespace std;

int main()
{
 int i,n, j, k;

 cout<<"Enter How Many Times You Want To Print Pattern\n";
 cin>>n;

 for(i=n;i>=1;i--)
 {
  for(j=n;j>i;j--)
  {
   cout<<" ";
  }
  for(k=1;k<(i*2);k++)
  {
   cout<<"*";
  }
 
 cout<<"\n";
 }
return 0;
}

 

Output:

Enter How Many Times You Want To Print Pattern

10

*******************

 *****************

  ***************

   *************

    ***********

     *********

      *******

       *****

        ***

         *

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

This question belongs to these collections

Similar questions


need a help?


find thousands of online teachers now