2个回答
展开全部
public class Exam
{
public static void main(String[] args)
{
int[] matrix={7,4,8,9,1,5};
int loop=0,i,c;
for(int n=0;n<6;n++)
{
for(i=loop,c=0;c<5;c++)
{
System.out.printf("%d ",matrix[i]);
i=++i%6;
}
System.out.print(matrix[i]);
System.out.println();
loop=i%6;
}
}
}
{
public static void main(String[] args)
{
int[] matrix={7,4,8,9,1,5};
int loop=0,i,c;
for(int n=0;n<6;n++)
{
for(i=loop,c=0;c<5;c++)
{
System.out.printf("%d ",matrix[i]);
i=++i%6;
}
System.out.print(matrix[i]);
System.out.println();
loop=i%6;
}
}
}
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
int n[] = {7, 4, 8, 9, 1, 5};
for (int i = 0; i < n.length; ++i) {
for (int k : n)
System.out.print(k);
System.out.println();
int s[] = new int[n.length];
for (int j = 0; j < n.length; ++i)
s[j] = n[j == n.length - 1 ? 0 : j + 1];
n = s;
}
for (int i = 0; i < n.length; ++i) {
for (int k : n)
System.out.print(k);
System.out.println();
int s[] = new int[n.length];
for (int j = 0; j < n.length; ++i)
s[j] = n[j == n.length - 1 ? 0 : j + 1];
n = s;
}
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询