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

 找回密码
 加入黑马

QQ登录

只需一步,快速开始

© 平凡的鱼 中级黑马   /  2015-9-16 21:31  /  513 人查看  /  13 人回复  /   0 人收藏 转载请遵从CC协议 禁止商业使用本文

这几天学习的知识总结  自己把代码调到了一块  发个帖子  大家共同勉励

import java.util.Scanner;
class Day08_exec {
        public static void main(String[] args) {
        //Export.export(10);
        //Export.getDaffodil();
        //Export.scanner();
        //Export.judge();
        int[] arr={19,14,20,25,19,13,12,9,20,14,8,12,14,6,26,23,22,24,19,21,14,14,12,9,51,21,16,14,17,27,1,27,27,7,1,23,27,37,15,26,12};
        Export.add(arr);
        }
}
//请在控制台输出数据1-10
class Export{
        public static void  export(int y){
                for(int x=1;x<=10;x++){
                        System.out.println(x);
                }
        }
//求水仙花数和值
        public static void getDaffodil(){
                int num=0;
                //int daff=0;
                for(int x=100;x<1000;x++){
                        int ge=x%10;
                        int shi=x/10%10;
                        int bai=x/10/10%10;
                        if((ge*ge*ge+shi*shi*shi+bai*bai*bai)==x){
                                num++;
                                System.out.print(x+"        ");
                                System.out.println();
                               
                        }else{
                                continue;
                        };
                }
                System.out.println(num+"        ");
        }                                                       
//键盘录入学生的信息,但是什么时间结束呢?当用户输入的信息"886"时结束循环
        public static void scanner(){
                Scanner s=new Scanner(System.in);
                while(true){
                        String x=s.next();
                        if(x=="886"){                                                                //在API中,next是扫描一个完成的标记 为什么不终止循环呢???
                                break;
                        }
                }
        }
        //if练习  
        public static void judge(){
                Scanner s=new Scanner(System.in);
                int x=s.nextInt();
                if(x%2!=0){
                        System.out.println("男厕所");
                }else if(x%2==0){
                        System.out.println("女厕所");
                }else{
                        System.out.println("没有了");
                }
        }
        public static void add(int[] arr){
                int sum=0;
                for(int x=0;x<arr.length-1;x++){
                        sum+=arr[x];
                }
                System.out.println(sum);
                System.out.println((int)(sum/60));
        }
}

评分

参与人数 1技术分 +1 收起 理由
洋葱头头 + 1

查看全部评分

13 个回复

倒序浏览
给个赞把 不容易
回复 使用道具 举报

谢谢  葱头大神
回复 使用道具 举报
凑点分挺难的
回复 使用道具 举报
为了凑分 楼主也是蛮拼的 哈哈
回复 使用道具 举报
辛苦了   赞一个
回复 使用道具 举报
我又来帮顶了
回复 使用道具 举报
清明月雨上 发表于 2015-9-17 21:21
为了凑分 楼主也是蛮拼的 哈哈

理解万岁
回复 使用道具 举报

谢谢  支持
回复 使用道具 举报

理解理解
回复 使用道具 举报

  谢谢
回复 使用道具 举报
张寰宇 来自手机 中级黑马 2015-9-19 21:13:21
12#
谢谢分享 学习了
回复 使用道具 举报
大侠,膜拜你!
回复 使用道具 举报
赞一个,学习了
回复 使用道具 举报
您需要登录后才可以回帖 登录 | 加入黑马