练习1
import java.util.Scanner; public class Mying1 { public static void main(String[] args) { Scanner in = new Scanner(System.in); int a = in.nextInt(); int b = in.nextInt(); int c = in.nextInt(); int sum = a+b+c; System.out.println(sum); } }
练习2
import java.util.Scanner; public class Mying2 { public static void main(String[] args) { Scanner in = new Scanner(System.in); int a = in.nextInt(); int b = in.nextInt(); int c = in.nextInt(); int he = a+b; if (he>c){ System.out.println(true); }else if (he<=c){ System.out.println(false); } } }
练习3
import java.util.Scanner; public class Mying3 { public static void main(String[] args) { Scanner in = new Scanner(System.in); int a = in.nextInt(); int b = in.nextInt(); int c = in.nextInt(); int d = in.nextInt(); int he = a+b+c-d; if (he>0){ System.out.println(true); }else if (he<=0){ System.out.println(false); } } } 练习4
import java.util.Scanner; public class Mying4 { public static void main(String[] args) { Scanner in = new Scanner(System.in); int chang = in.nextInt(); int kuan = in.nextInt(); int mianji = chang*kuan; System.out.println("面积是"+mianji); } }
练习5
import java.util.Scanner; public class Mying5 { public static void main(String[] args) { Scanner in = new Scanner(System.in); int r = in.nextInt(); double t = 3.14; System.out.println("面积"+(r*r*t)); } }
练习6
import java.util.Scanner; public class Ner1 { public static void main(String[] args) { Scanner in =new Scanner(System.in); int shengao = in.nextInt(); int tizong = in.nextInt(); System.out.println("你的标准身高是:"+(shengao+tizong)/2); } }
练习7
import java.util.Scanner; public class Ner2 { public static void main(String[] args) { Scanner in =new Scanner(System.in); int xinzi = in.nextInt(); double shenlu = 0.01; System.out.println("实际到手工资是:"+(1-shenlu)*xinzi); } }
练习8
import java.util.Scanner; public class Ner3 { public static void main(String[] args) { Scanner in =new Scanner(System.in); int zs = in.nextInt(); System.out.println("整数平方为"+zs*2); } }
练习9
import java.util.Scanner; public class Ner4 { public static void main(String[] args) { Scanner in =new Scanner(System.in); int num = in.nextInt(); int s = num%2; if(s==0){ System.out.println("偶数"); }else { System.out.println("奇数"); } } }
练习10
import java.util.Scanner; public class Ner5 { public static void main(String[] args) { Scanner in =new Scanner(System.in); int sr = in.nextInt(); int sz = sr-20; if (sr>sz){ System.out.println("果真吗"); }else { System.out.println("成年了"); } } }