1234567
123567
1267
17 write a java program to print this pattern
Answers
Answer:
System.out.println("1234567");
System.out.println("123567");
System.out.println("1267");
Explanation:
This is an old school method lmao
but you can also use this:
public class Main {
public static void main(String[] args) {
for (int i = 1; i < 8; i++)
{
System.out.print(i);
}
System.out.println(" ");
for (int j = 1; j < 4; j++)
{
System.out.print(j);
}
for (int k = 5; k < 8; k++)
{
System.out.print(k);
}
System.out.println(" ");
for (int l = 1; l < 3; l++)
{
System.out.print(l);
}
for (int m = 6; m < 8; m++)
{
System.out.print(m);
}
System.out.println(" ");
int a=1;
int b=7;
{
System.out.print(a+""+""+b);
}
}
}
op:
1234567
123567
1267
17