JAVA function1

public static void degreeOfTriangle(){
Scanner input = new Scanner(System.in);
System.out.println(“输入三角形有几条边:”);
int n = input.nextInt();
float totalDegree = (n-1)*180;
float[] degree =new float[n-1];
System.out.println(n+“边形”+totalDegree+“度”);
System.out.println(“输入其中”+(n-1)+“边的度数”);
for (int i = 0;i<n-1;i++)
degree[i] = input.nextFloat();
float total = 0;
for(int i = 0;i<n-1;i++)
total += degree[i];
System.out.println(“另外一个角为”+(totalDegree - total) + “度”);
}

猜你喜欢

转载自blog.csdn.net/weixin_44895008/article/details/89862836
今日推荐