C++ program to draw following pattern using loops : 1****** 12***** 123**** 1234*** 12345** 123456* 1234567

C++ program to draw following pattern using for loops :
1******
12*****
123****
1234***
12345**
123456*
1234567

C++ code is here.

Code:

//start
#include<iostream>
using namespace std;

void main()
{      //declaration of variables
       int x,y;
       for(x=1;x<=7;x++)
              {
                     for(y=1;y<=x;y++)
                            {
                                  cout<<y;
                           }
                     for(;y<=7;y++)
                           {
                                  cout<<"*";
                           }
             
                          
                     cout<<endl;
              }

       system("pause");
}

//End

Output:

Comments