Computer Science, asked by baiju333444, 1 year ago

how to print in this diamond pattern?


1
212
32123
4321234
543212345

Answers

Answered by prakriti27
7
class Pattern
{
int i, j, k, l;
for(i=1; i<=5; i++)
{
for(j=1; j<=5-i; j++)
{
Sop(" ");
}
for(k=1; k>=1; k++)
{
Sop(k);
}
for(l=2; l<=i; l++)
{
Sop(l);
}
}
for(i=4; i>=1; i--)
{
for(j=1; j<4-i; j--)
{
Sop(" ");
}
for(k=i; k>=1; k--)
{
Sop(k);
}
for(l=2; l<=i; l++)
{
Sop(l);
}
Sopln();
}
}
}

prakriti27: pls!! pls!! mark as the best
Similar questions