wap Java program pattern
1234
1234
234
234
34
34
4
4
Answers
Answered by
10
The given code is written in Java.
public class Pattern {
public static void main(String args[]){
int i,j,n=4;
for(i=1;i<=n;i++){
for(j=i;j<=n;j++)
System.out.print(j+" ");
System.out.println();
for(j=i;j<=n;j++)
System.out.print(j+" ");
System.out.println();
}
}
}
See the attachment for output.
Attachments:
Answered by
1
Answer:
Program:-
public class Main
{
public static void main(String args[])
{
for(int i=1;i<=4;i++)
{
for(int j=i;j<=4;j++)
System.out.print(j+" ");//In order to print it one time
System.out.println();
for(int j=i;j<=4;j++)
System.out.print(j+" ");
System.out.println();//In order to print it second time
}
}
}
Attachments:
Similar questions