1011:
import java.util.Scanner; public class Main { public static void main(String[] args){ Scanner sca = new Scanner(System.in); double b = sca.nextDouble(); double k = b*(0.454); if (k<=1) { System.out.printf("%.1f"+" kilogram",k); } else { System.out.printf("%.1f"+" kilograms",k); } } }
1012:
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sca = new Scanner(System.in); double a = sca.nextDouble(); double b = sca.nextDouble(); double c,d; b = b/100; c = a*b; d = c+a; System.out.printf("The gratuity is "+"%.2f"+" and total is "+"%.2f",c,d ); } }
1013:
import java.util.Scanner; public class Main { public static void main(String[] args){ Scanner sca = new Scanner(System.in); int a = sca.nextInt(); int b,c,d,e; if (a!=1000){ b = a%10; c = (a-b)%100; d = c/10; e = (a-b-c)/100; System.out.println("The sum of the digits is "+(b+d+e)); } else { System.out.println("The sum of the digits is 1"); } } }
1014:
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sca = new Scanner(System.in); double a = sca.nextDouble(); double b, c, d; if (a!= 0) { b = a % (365 * 24 * 60);// 剩余分钟数 c = b / (24 * 60);//天数 d = (a - b) / (365 * 24 * 60);//年数 if (d == 1 && c == 1) { System.out.println("Approximately " + "1" + " year " + "1" + " day"); } else if (d == 1 && c != 1 && c != 0) { System.out.println("Approximately " + "1" + " year " + (int) c + " days"); } else if (d != 1 && c == 1 && d != 0) { System.out.println("Approximately " + (int) d + " year " + "1" + " day"); } else if (d == 0 && c == 1) { System.out.println("Approximately " + "1" + " day"); } else if (d == 1 && c == 0) { System.out.println("Approximately " + "1" + " year "); } else { System.out.println("Approximately " +(int)d+ " years " +(int)c+ " days"); } } else { System.out.println(); } } }
1015:
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sca = new Scanner(System.in); int a = sca.nextInt(); if (a>=33&&a<=126) { char x = (char)a; System.out.println("The character for ASCII code "+a+" is "+x); } } }