永康住房城乡建设局网站,南宁两学一做网站,推广广告赚钱软件,唐山炎黄宽带网站1.编写程序#xff1a; 声明一个整型变量a#xff0c;并赋初值5#xff0c;在程序中判断a是奇数还是偶数#xff0c;然后输出判断的结果。 package 判断奇偶; public class liux { public static void main(String[] args){ int x5; if(x%20){ System.out.println(这…1.编写程序 声明一个整型变量a并赋初值5在程序中判断a是奇数还是偶数然后输出判断的结果。 package 判断奇偶; public class liux { public static void main(String[] args){ int x5; if(x%20){ System.out.println(这个数为偶数); }else System.out.println(这个数为奇数); } } 2.编写程序从键盘输入圆的半径计算圆的面积并输出。 package 计算圆的面积;import java.util.Scanner;public class liux { static final double PI 3.14159; public static void main(String[] args){ Scanner scannernew Scanner(System.in); int r; System.out.println(请输入圆的半径); rscanner.nextInt(); System.out.println(圆的面积为PI*r*r); scanner.close(); } } 3.编写程序实现一个数字加密器。运行时输入加密前的整数通过加密运算后输出加密后的结果加密结果仍为一整数。 package 加密器;import java.util.Scanner;public class liux { public static void main(String[] args) { Scanner scannernew Scanner(System.in); int x; System.out.println(请输入加密前的数字); xscanner.nextInt(); int n; n(int) ((x*105)/23.1415926); System.out.println(加密后的数字为n); scanner.close(); }} 4.声明并创建存放4个人考试成绩的一维数组并使用for循环遍历数组并打印分数。要求 首先按“顺序”遍历即打印顺序为从第一个人到第四个人然后按“逆序”遍历即打印顺序为从从第四个人到第一个人输出最高分 输出最低分package 一维数组;import java.util.Scanner;public class liux { SuppressWarnings(resource) public static void main(String[] args){ int student[]new int[5]; int i; Scanner scorenew Scanner(System.in); for(i4;i0;i--){ student[i]score.nextInt(); System.out.println(第i个学生的成绩为student[i]); } int maxstudent[1]; int minstudent[1]; for(i1;i5;i){ if(maxstudent[i]) maxstudent[i]; } if(minstudent[i]) minstudent[i]; } } 转载于:https://www.cnblogs.com/liuxun1031/p/10695214.html