public static void main(String[] args) { Scanner sc = new Scanner(System.in); float x= sc.nextFloat(),y; if(x==0) y=0; else y=1/x; System.out.format("f(%.1f) = %.1f",x,y); }
觉得有用的话采纳一下哈