import java.util.*; public class San{ public static void main(String args[]) { int i=0,j=0
importjava.util.*;publicclassSan{publicstaticvoidmain(Stringargs[]){inti=0,j=0,r=0,k;...
import java.util.*;
public class San{
public static void main(String args[])
{
int i=0,j=0,r=0,k;
Scanner scanner;
scanner=new Scanner(System.in);
System.out.println("请输入数字");
k=scanner.nextInt();
for(i=1;i<=k;i++)
{
for(r=0;r<=k-i;r++)
{
System.out.print(" ");
}
for(j=0;j<i;j++)
{
if(i%2==1)
System.out.print("1 ");
else
if(i%2==0)
System.out.print("2 ");
}
System.out.println("");
}
}
}什么意思啊 展开
public class San{
public static void main(String args[])
{
int i=0,j=0,r=0,k;
Scanner scanner;
scanner=new Scanner(System.in);
System.out.println("请输入数字");
k=scanner.nextInt();
for(i=1;i<=k;i++)
{
for(r=0;r<=k-i;r++)
{
System.out.print(" ");
}
for(j=0;j<i;j++)
{
if(i%2==1)
System.out.print("1 ");
else
if(i%2==0)
System.out.print("2 ");
}
System.out.println("");
}
}
}什么意思啊 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询