package programs500;
import java.util.Scanner;
public class Pattern1234_2341 {
public static void main(String[] args) {
Scanner s=new Scanner(System.in);
int n=s.nextInt();
int t=0;
for(int i=1;i<=n;i++)
{
int count=1;
t=i;
if (i>4)
{
t=i-4;
}
for(int j=t;j<=4;j++)
{
System.out.print(j + " ");
count++;
}
int k=1;
while(count<=4)
{
System.out.print(k + " ");
k++;
count++;
}
System.out.println();
}
}
}
Q- My code is executing the pattern till n=9. Can anyone help for for n>9 numbers?
Aucun commentaire:
Enregistrer un commentaire