1:平行四边形
class Day4Test3
{
public static void main(String[] args)
{
for (int x = 0;x<3 ;x++ )
{
for (int y = x;y<2 ;y++ )
{
System.out.print(" ");
}
for (int z = 0;z<7 ;z++ )
{
System.out.print("* ");
}
for (int z = 0;z<=x ;z++ )
{
System.out.print(" ");
}
System.out.println();
}
}
}
2:水仙花
class Prog4
{
public static void main(String[] args)
{
for (int x = 100;x<1000 ;x++ )
{
int bai = x/100;
int shi = x/10%10;
int ge = x%10;
if (x==(bai*bai*bai+shi*shi*shi+ge*ge*ge))
{
System.out.println(x);
}
}
}
}
3:这是个自己娱乐自己的小代码,可以偷偷试试
import java.util.Scanner;
class YingXiongLianMeng
{
public static void main(String[] args)
{
while(true)
{
Scanner sc = new Scanner(System.in);
System.out.println("您已经超神了,请输入您赢得场次");
int x = sc.nextInt();
String paiwei;
if (x>1000)
{
paiwei = "大师";
}
else if (x>800 && x<=1000)
{
paiwei = "钻石";
}
else if (x>600 && x<=800)
{
paiwei = "黄金";
}
else if (x>400 && x<=600)
{
paiwei = "白银";
}
else if (x>200 && x<=400)
{
paiwei = "青铜";
}
else
{
paiwei = "菜鸟";
}
System.out.println(x+"---"+paiwei);
}
}
}
|
|