23/11/2015

C++ Program To Print A Given Reverse STAR Pattern

Problem :- 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
C++ Program To Print A Given Triangle of STARS

Solution :-

#include<iostream>
using namespace std;

int main()
{
//By-Ghanendra Yadav 
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:-

C++ Program To  Print A Given Reverse STAR Pattern

Previous Post
Next Post

post written by:

Hi, I’m Ghanendra Yadav, SEO Expert, Professional Blogger, Programmer, and UI Developer. Get a Solution of More Than 500+ Programming Problems, and Practice All Programs in C, C++, and Java Languages. Get a Competitive Website Solution also Ie. Hackerrank Solutions and Geeksforgeeks Solutions. If You Are Interested to Learn a C Programming Language and You Don't Have Experience in Any Programming, You Should Start with a C Programming Language, Read: List of Format Specifiers in C.
Follow Me

0 Comments: