Computer Science, asked by khushboo5, 1 year ago

executed examples of nested for loops for patterns programming of java The questions are as follows 1514131211 10987 654 32 1

Answers

Answered by Anonymous
2
The program is:-

class pattern
{
public static void main(String args[])
{
int s=5;
for (int i=1;i<=3;i++)
{
for(int j=2;j<=i;j++)
{
System.out.print("  ");
}
for(int k=1;k<=s;k++)
{
System.out.print("* ");
}
s=s-2;
System.out.println("");
}
s=3;
for (int i=1;i<=2;i++)
{
for(int j=1;j>=i;j--)
{
System.out.print("  ");
}
for(int k=1;k<=s;k++)
{
System.out.print("* ");
}
s=s+2;
System.out.println("");
}
}
}

Output:-

* * * * *
  * * *
    *
  * * *
* * * * *

Hope it helps , if you want more programmings then ask in comments.

If it helps please mark it as brainliest.....

kvnmurty: what does this program do? describe its function pls
Similar questions