• 2


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

        }
    }

  • 相关阅读:
    CodeForces 1332D Walk on Matrix
    CodeForces 1324F Maximum White Subtree
    CodeForces-1324E-Sleeping-Schedule
    CodeForces-1324D-Pair-of-Topics
    理解字节序 大端字节序和小端字节序
    公钥 私钥 数字证书概念理解
    简要介绍 X Window System (又称为X11 or X)
    动态规划的简洁说明
    二分法的研究
    两个变量的内容交换
  • 原文地址:https://www.cnblogs.com/777lixiaohui/p/7538326.html
Copyright © 2020-2023  润新知