Java作业二(2017-9-18)
/*程序员龚猛,求整数各个位上的和*/
import java.util.Scanner;
public class Helloworld
{
public static void main(String[] args)
{
Scanner input=new Scanner(System.in);
System.out.print("Enter a number 0 and 1000 :");
int number =input.nextInt();
int bit=number%10;
number=number/10;
int ten=number%10;
number=number/10;
int kil=number%10;
System.out.println("The sum of the digits is "+(bit+ten+kil))
}
}
/*程序员龚猛,两点的距离*/
package HelloWorld;
import java.util.Scanner;
public class HelloWorld {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
System.out.print("输入x1和y1:");
double x1 =input.nextDouble();
double y1 =input.nextDouble();
System.out.print("输入x2和y2:");
double x2 =input.nextDouble();
double y2 =input.nextDouble();
double x =Math.pow((x2 - x1),2);
double y =Math.pow((y2 - y1),2);
System.out.println("两个点之间的距离是:"+ Math.pow((x+y),0.5));
}
}
最新文章
- 对Golang的一些看法
- python 处理中文文件时的编码问题,尤其是utf-8和gbk
- centos mysq table is read only
- laraval框架model注意事项
- poj 3207 2-SAT问题
- Facebook的手游出海之道
- 『局域网安全』利用ARP欺骗劫持Cookie
- 学php之翻译wordpress(2)
- JAVA的class打包成dll
- 重新想象 Windows 8 Store Apps (9) - 控件之 ScrollViewer 基础
- Linux基础之常用命令整理(一)
- Django 信号、中间件、i18n 专题
- Windows下 OpenSSL DES加密配置
- idea vue.js插件安装
- node.js依赖express解析post请求四种数据格式()
- mui---获取入口文件对象
- Liunx clear
- 【转载】.NET/C#-uploadify视频文件or大文件上传
- 【LinuxC】GCC编译C程序,关闭随机基址
- WhyDX9:翻写D3D红龙书中的程序
热门文章
- sqlmap基础入门超详细教程
- RT-SA-2019-005 Cisco RV320 Command Injection Retrieval
- 计算机视觉学习记录 - Implementing a Neural Network from Scratch - An Introduction
- python模块 - pywinauto(windows自动化安装软件)
- pythonのdjango
- PHP 【三】
- Alpha 冲刺 (9/10)
- 小程序引入百度api天气预报
- 论文阅读 | A Curriculum Domain Adaptation Approach to the Semantic Segmentation of Urban Scenes
- Win10安装java环境