randomposts
Powered by Blogger.

Write a program to print following triangle. a. Get input from user to print n number of line.

No comments


Write a program to print following triangle.
a. Get input from user to print n number of line.
e.g. (n=5)
 * * * * *
 * * *
 * *
 *
 *

# Program Code Here
Note: *Remove the sentence___(Don’t Missing Syntax Required)

#include<iostream.h>
#include<conio.h>
class tri
{
     int i,j,k,no;

     public:
     getdata()___(Don’t Missing Syntax Required)
     {
     cout<<"enter number for how many row display:";___(Don’t Missing Syntax Required)
     cin>>no;___(Don’t Missing Syntax Required)
     cout<<endl;___(Don’t Missing Syntax Required)
     }
    void display()
     {
           for(i=1;i<=no;i++)
           {
                for(k=no;k>=i;k--)
                {
                     cout<<"*";___(Don’t Missing Syntax Required)
                }
                for(j=1;j<=i;j++)
                {
                     cout<<" ";
                }

                cout<<endl;___(Don’t Missing Syntax Required)
             }
      }
     };
     void main()
     {
     clrscr();
     tri o;
     o.getdata();
     o.display();
     getch();
    }


No comments :

Post a Comment