Java自学第四十七天

  今天继续做pta题。

  

  代码如下

  

import java.util.Scanner;
public class Main{
public static void main(String[] args){
Scanner cn=new Scanner(System.in);
int k=cn.nextInt();
boolean[] boo=new boolean[k];
for(int i=0;i<k;i++){
double a=cn.nextDouble();
double b=cn.nextDouble();
double c=cn.nextDouble();
boo[i]=(a+b>c);
}
for(int i=0;i<k-1;i++){
System.out.println("Case #"+(i+1)+": "+boo[i]);
}
System.out.println("Case #"+k+": "+boo[k-1]);
}
}

  这道题目比较简单,我做这道题的目的也是因为以前的题目没有遇到过Boolean类型数据,这道题目使用Boolean类型可以很方便的解决。

  明天继续找题目。

原文地址:https://www.cnblogs.com/ruangongwangxiansheng/p/13588521.html