Using nested loop write a program to print the following pattern on the screen.
12345
23451
34512
45123
51234
Answers
Answered by
0
Answer:
import java.io.*;
public class example {
public static void main (String args[]){
int i, k, j;
for(i=1;i<=5;i++){
for (j=1;j<=5;j++){
for(k=i;k<=5+1;k++){
if(k==5){
k=1;
System.out.print(k);
}}}
System.out.println();
}
}}
Similar questions