Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*pattern program
- 1 1 1 1 1
- 1 2 2 2 1
- 1 2 3 2 1
- 1 2 2 2 1
- 1 1 1 1 1
- */
- #include<iostream>
- using namespace std;
- int main()
- {
- int i=1,j=1,k=0,ans=1;
- for(i=1;i<=5;i++)
- {
- for(j=1;j<=5;j++)
- {
- //cout<<" "<<j+k;
- if(i==1 || i==5 || j==1 || j==5 )
- {
- cout<<"1";
- }
- else if(i==3 && j==3)
- {
- cout<<"3";
- }
- else
- {
- cout<<"2";
- }
- }
- cout<<"\n";
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment