摘要:
/* 打印螺旋矩阵* 所谓螺旋矩阵,即:* 比如 N = 3,打印:* 1 2 3* 8 9 4* 7 6 5** N = 4,打印:* 1 2 3 4* 12 13 14 5* 11 16 15 6* 10 9 8 7**/import java.util.*;public class lianxi14{ public static void main(String[] args){ int N = 0; Scanner sc = new Scanner(System.in); ... 阅读全文
摘要:
输入某年某月某日,判断这一天是这一年的第几天?import java.util.*;public class lianxi09{ public static void main(String[] args){ int year = 0, month = 0, day = 0; int run = 0, d = 0; int[] monthday = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; Scanner sc = new Scanner(System.... 阅读全文
摘要:
求s=a+aa+aaa+aaaa+aa...a的值,其中a是一个数字。例如2+22+222+2222+22222(此时共有5个数相加),几个数相加有键盘控制。import java.util.*;public class lianxi05{ public static void main(String[] args){ Scanner sc = new Scanner(System.in); System.out.println("输入数字a的值:"); int a = sc.nextInt(); System.out.printl... 阅读全文