Java开发中经典的小实例-(输入三个数字判断三角形类型)
import java.util.Scanner;
public class threeTest {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
System.out.println("请输入第一条边:");
int a = input.nextInt();
System.out.println("请输入第二条边:");
int b = input.nextInt();
System.out.println("请输入第三条边:");
int c = input.nextInt();
if (b * b + c * c > a * a) {
System.out.println("这个三角形是锐角三角形.");
} else if (b * b + c * c == a * a) {
System.out.println("这个三角形是直角三角形.");
} else if (b * b + c * c < a * a) {
System.out.println("这个三角形是钝角三角形.");
} else {
System.out.println("你的三条边组成不了三角形。");
}
}
}
Java开发中经典的小实例-(输入三个数字判断三角形类型)的更多相关文章
- Java开发中经典的小实例-(打印输入重复的值)
import java.util.ArrayList;import java.util.Scanner;public class Test8 { public static void main( ...
- Java开发中经典的小实例-(比较输入数值的最大值、最小值和平均值)
//输入数字个数来产生数字并且比较大小 import java.util.Scanner;public class Test1 { public static void main(String ...
- Java开发中经典的小实例-(while(参数){})
import java.util.Scanner;public class Test_while { public static void main(String[] args) { ...
- Java开发中经典的小实例-(二分法)
public int binarySearch(int[] data,int aim){//以int数组为例,aim为需要查找的数 int start = 0; int end = data.leng ...
- Java开发中经典的小实例-(if(参数){}else{})
import java.util.Scanner; public class Calculate { public static void main(String[] args) { ...
- Java开发中经典的小实例-(swich(){case:参数break;default: break;})
import java.util.Scanner;public class Test6 { public static void main(String[] args) { // ...
- Java开发中经典的小实例-(能被3整除,并且十个数换一行)
import java.util.Scanner;public class Test15 { public static void main(String[] args) { // ...
- Java开发中经典的小实例-(do{}while())
import java.util.Scanner;public class Test13 { public static void main(String[] args) { // ...
- Java开发中经典的小实例-(字符串倒序输出)
public class Test12 { public static void main(String[] args) { // TODO Auto-generated meth ...
随机推荐
- 设置文本框左边显示的View
效果:
- (转)对比MS Test与NUnit Test框架
前言: 项目中进行Unit Test时,肯定会用到框架,因为这样能够更快捷.方便的进行测试. .Net环境下的测试框架非常多,在这里只是对MS Test和NUnit Test进行一下比较, 因为这两个 ...
- LuaSrcDiet工具介绍(lua源码处理软件)
Diet Food Diet (nutrition), the sum of the food consumed by an organism or group Dieting, the delibe ...
- jdbc 数据的增删改查的Statement Resultset PreparedStatement
完成数据库的连接,就马上要对数据库进行增删改查操作了:先来了解一下Statement 通过JDBC插入数据 (这里提供一个查找和插入方法) Statement:用于执行sql语句的对象: *1.通过C ...
- Hdu 1081 To The Max
To The Max Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total ...
- mysql 常用语句模板
插入INSERT IGNORE INTO test (`f1`, `f2`, `f3`) VALUES (v1,v2,v3); 更新update test set f1=v1,f2=v2 where ...
- VIM 常用快捷键
一,光标移动 大家不要觉得光标移动不重要,其实它是基础,更好的光标移动,复制,粘贴,删除等才能更加的得心应手,进入了编辑器里面后,鼠标就不能用了. 光标移动 h 或 向左箭头键(←) 20h或者20( ...
- UI,切图,命名
APP切图流程和APP切图命名规范详细完整版 http://www.25xt.com/appdesign/7339.html Marketch
- mysql5.6.23免安装配置
1.官网下载,并解压 2.环境变量,path下,追加mysql的bin路径D:\Program Files\mysql\bin; 3.mysql目录下的my-default.ini重命名为my.ini ...
- vim如何配置go语言环境
go语言没有如source insight般优秀的编辑器,试用了多种,vim算最好的,其次可以用liteide(有反查变量函数引用点.修改行变色功能),两者可配合使用. 更新:最好的是idea+go插 ...