please show me its a loop programming concept
Answers
Answer:
public class MainClass
{
public static void main(String[] args)
{
for (int i = 1; i<= 5; i++)
{
for (int j = 5; j>= i; j--)
{
System.out.print(j);
}
System.out.println();
}
System.out.println("new pattern");
for (int i = 1; i<= 5; i++)
{
for (int j = 6-i; j>= 1; j--)
{
System.out.print(j);
}
System.out.println();
}
System.out.println("new pattern");
for (int i = 7; i>= 1; i=i-2)
{
for (int j = 1; j<= i; j++)
{
System.out.print(j);
}
System.out.println();
}
System.out.println("new pattern");
for (int i = 1; i<= 4; i++)
{
for (int j = 1; j<= i; j++)
{
System.out.print("@");
}
System.out.println();
}
}
}
Explanation:
I have made all patterns in single program
you can seperate it out
in making any pattern
outer loop is always used for no. of rows and inner loop is adjusted so that to make the required pattern...