A股上市公司传智教育(股票代码 003032)旗下技术交流社区北京昌平校区

 找回密码
 加入黑马

QQ登录

只需一步,快速开始

© 王希悦 中级黑马   /  2015-1-22 00:20  /  1525 人查看  /  6 人回复  /   0 人收藏 转载请遵从CC协议 禁止商业使用本文

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);
                }
        }
}

6 个回复

倒序浏览
给楼主一个大大的赞   
回复 使用道具 举报
点个赞。
回复 使用道具 举报
点个赞。。。
回复 使用道具 举报
我也点个赞
回复 使用道具 举报
点个赞~~~~~
回复 使用道具 举报
好闲哦..................
回复 使用道具 举报
您需要登录后才可以回帖 登录 | 加入黑马