* pattern using for & while loop

Code:

#include<iostream>
using namespace std;
void main()
{
//Print * pattern using for & while loop.
int clm=0; //column control variable 
for(int row =7; row>=1; row--) //row control loop..
{
clm=1;
while(clm<=row) //column control loop...
{
cout<<"*";
clm++;
}
cout<<endl; //transfer control to next line...
}
system("pause");
}

Output:


Video:



Comments

Popular Posts