WAP TO PRINT PATTERN 3


                                                                              *
                                                                            *  *
                                                                          *      *
                                                                        *          *
                                                                      *              *
                                                                    *  *  *  *  * *
#include<iostream.h>
#include<conio.h>
#include<stdio.h>
Void main()
{
     int i,j,n;
     clrscr();
     cout<<”Enter the value of n:”;
     cin>>n;
     for(i=1;i<=n;i++)
           {
                for(j=1;j<=I;j++)
                {
                     cout<<”  ”;
                 }
                 for(j=1;j<=I;j++)
                 {
                      if(j==1||i==n)
                      {    
                           cout<<”*”;
                      }
                      else
                      {
                            cout<<”  ”;
                      }
                      for(j=1;j<i;j++)
                      {
                            if(j==i-1||i==n)
                            {
                                   cout<<”*”;
                             }
                             else
                             {
                                  cout<<”  ”;
                              }
                       }
                          cout<<”\n”;
                 }
                   getch();
   }


    
           

Comments

Popular Posts