题目解析
判断给定价格 是否小于需要提醒的价格
解题思路
比较两个数 然后输出即可…
代码
import java.io.*;
import java.math.*;
import java.util.*;
public class Main
{
public static void main(String[] args)
{
int n = sc.nextInt();
int m = sc.nextInt();
while (n-- > 0)
{
double p = sc.nextDouble();
if (p < m)
out.printf("On Sale! %.1f\n", p);
}
out.flush();
out.close();
}
static Scanner sc = new Scanner(System.in);
static PrintWriter out = new PrintWriter(System.out);
}