# Print Number Star Square Pattern Type5

### 5 comments on “Print Number Star Square Pattern Type5”

• udhayakumar2352000

#include
int main()
{
int n = 5,i,j,k,l,m,o,p,q,r,s,temp=0,temp1=0;
k=1,o=13;
if(n>=3)
{
for(i=0;i3)
{
for(j=l;j<l+4;j++)
{
printf("%d",j);
if(temp<=2)
{
printf("*");
}
temp++;
}
k = k+8;
temp = 0;
printf("\n");
}
n–;
}
}
if(n<3)
{
for(m=0;m<2;m++)
{
r= o;
for(p=r;p<o+4;p++)
{
printf("%d",p);
if(temp1<=2)
{
printf("*");
}
temp1++;
}
o = o-8;
temp1=0;
printf("\n");
}
}
}

• Saravanakumar

#include
using namespace std;

int main() {
int n;
cin>>n;
int size=(n/2)+1;
int a[size];
int count=1;
for(int i=0;i<size;i++)
{
a[i]=count;
count+=2*n;
}
for(int i=0;i<n/2;i++)
{
for(int j=1;j<=n;j++)
{
cout<<a[i];
a[i]=a[i]+1;
if(j<n)
cout<<"*";
}
cout<<endl;
}
if(n%2!=0)
{
for(int i=1;i<=n;i++)
{
cout<<a[n/2];
a[n/2]+=1;
if(i<n)
cout<<"*";
}
cout<=0;i–)
{
for(int j=1;j<=n;j++)
{
cout<<a[i];
a[i]=a[i]+1;
if(j<n)
cout<<"*";
}
cout<<endl;
}
return 0;
}

• Stephen Reigns

#include
int main()
{
int num,rows,cols,count=0;
scanf(“%d”,&num);
for(rows=1;rows<=num;rows++)
{
for(cols=1;cols<=num-1;cols++)
{
count++;
if(cols==num-1)
printf("%d",count);
else
printf("%d*",count);
}
if(rows<=2)
count=count+num-1;
else
count=count-((rows-1)*(num-1));
printf("\n");
}
return 0;
}