Pattern printing in C++
#include<iostream>
using namespace std;
int main()
{
int i;
cout<<"\n Enter the value of i"<<endl;
cin>>i;
if(i==2)
cout<<" "<<endl;
else
cout<<" * "<<endl;
return 0;
}
Here in this program we will print a star pattern in the form of a square like
* * *
* *
* *
* * *
The above shown diagram is the output of the above program..
hope you understood how to print these pattern
All the Best!!
Note: The remaining patterns that has been given in the above image can be tried by the user by clicking the below button
0 Comments