11/23/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

Ghanendra Yadav

Ghanendra Yadav

Hello, I Am Ghanendra Yadav Owner of This Blog, I am professional Blogger and Programmer. I Love Programming, Logo Making, And Banner Designing. My Highest Qualification is MCA From NIT Warangal. You Can Find Me On Social Media Through Below Link And If You Have Any Query Related To Programming And Other Subject Comment Below or You Can Mail Me I Will Try To Answer Within 24 Hours Email:- yghanendra@student.nitw.ac.in

Find me on Social Media

Facebook | Twitter | Google+ | RSS Feed

No comments:

Post a Comment