Program to print half pyramid using * and 123 ||how to print a pattern in c++ // pyramid in pattern form with easy method //Source code
Source Code:
#include<iostream>
#nclude<conio.h>
using namespace std;
int main()
{
for(int r=1;r<=5; r++)
{
for(int c=1;c<=r;c++)
{
cout<<"*";
}
cout<<endl; // to terminate the row and went to next row
}
getch();
}
Output:
Output:
* * * * * * * * * * * * * * *
OUTPUT1 1 2 1 2 3 1 2 3 4 1 2 3 4 5Source Code:#include<iostream>#nclude<conio.h>using namespace std;int main(){for(int r=1;r<=5; r++) // this for loop is for rows{for(int c=1;c<=r;c++) // this for loop is for columns{cout<<c;}cout<<endl; // to terminate the row and went to next row}getch();}
Comments
Post a Comment