zoukankan      html  css  js  c++  java
  • 黄宗禹9.11作业

    2.6
    import java.util.Scanner;
           public class test
    {
           public static void main(String[] args)
       {
                  int a;
                  Scanner input=new Scanner(System.in);
                  System.out.print("Enter a number between 0-1000:");
                  int b=input.nextInt();
            if(b >= 0 && b <= 1000)
            {
                  a= b%10 + b/10%10 + b/100%10 +b/1000;
                  System.out.println("Sum of several numbers "+a);
            }
            else
            {
               System.out.println("Error!");
            }
       }
    }







    2.15


    import java.util.Scanner;

    public class test
    {
        public static void main(String[] args)
        {
            Scanner input=new Scanner(System.in);
            double x1,x2,y1,y2;
            System.out.println("Enter the x1 ");
            x1 = Double.valueOf(input.nextInt());
            System.out.println("Enter the y1 ");
            y1 = Double.valueOf(input.nextInt());
            System.out.println("Enter the x2 ");
            x2 = Double.valueOf(input.nextInt());
            System.out.println("Enter the y2 ");
            y2 = Double.valueOf(input.nextInt());
            System.out.println("The distance between the two points is "+ Math.pow((Math.pow((x2 - x1),2)+Math.pow((y2 - y1),2)),0.5));

        }
    }

  • 相关阅读:
    解决undefined reference to `__poll_chk@GLIBC_2.16' 错误
    交叉编译总结 libosscore.a libcurl.a libmysqlclient.a
    APUE环境配置
    UDT中epoll对CLOSE状态的处理
    查看ld搜索路径
    linux shell 比较文件夹内容 diff
    交互式makefile
    linux shell取文本最后一行
    linux 查看静态库,动态库是32位还是64位
    python学习day4之路
  • 原文地址:https://www.cnblogs.com/huangzongyu/p/7531962.html
Copyright © 2011-2022 走看看