摘要: /* 4.4 任务4:输出1-100之间的偶数(时间:20分钟) 4.4.1 任务描述 (1) 写一个程序,由用户输出1-100之间的偶数。 4.4.2任务目的 (1) 学习使用Java的循环语句。 4.4.3任务要求 (1) 使用循环 4.4.4 难点提示 无 4.5 任务5:输出1-100之间的奇数和(时间:20分钟) 4.5.1 任务描述 (2) 写一个程序,由用户输出1-100之间的奇数和。 4.5.2 任务目的 (2) 学习使用Java的循环语句。 4.5.3任务要求 (2) 使用循环 */public class demo{ public static void main(Stri 阅读全文
posted @ 2013-05-22 16:23 一个学渣 阅读(3643) 评论(0) 推荐(0) 编辑
摘要: import java.util.Scanner;/* * 使用switch实现简易的计算器(实现加减乘除); */public class test { public static void main(String[] args) { Scanner sc = new Scanner(System.in); System.out.println("输入一个表达式(例如: 5 + 3):"); int a = sc.nextInt(); char ch = sc.next().charAt(0); int b = sc.nextInt(); switch (ch) { ca 阅读全文
posted @ 2013-05-22 16:08 一个学渣 阅读(7375) 评论(0) 推荐(0) 编辑
摘要: /*第四章 * 5.1求水花仙数 * 求1000以内所有的水花仙数,所谓水花仙数就是一个三位数,个位数,十位数,百位数的立方和等于这个数的自身。 */public class test { public static void main(String[] args) { int n1; int n2; int n3; for (int i = 101; i < 1000; i++) { n3 = i / 100;// 百位数 n2 = i % 100 / 10;// 十位数 n1 = i % 10;//个位数 if (n1 * n1 * n1 + n2 * n2 *... 阅读全文
posted @ 2013-05-22 16:02 一个学渣 阅读(587) 评论(0) 推荐(0) 编辑
摘要: //第四章 5.2 打印九九乘法表//提示 使用双层循环,内循环次数是当前外层循环的循环变量值。public class test { public static void main(String[] args) { for (int i = 1; i 0; j--) { System.out.print(" "); } for (int j = 1; j <= i; j++) { if (j <= i) { System.out.print(" "+i + "X" + j + "=" + i * j 阅读全文
posted @ 2013-05-22 15:59 一个学渣 阅读(533) 评论(0) 推荐(0) 编辑

 

CSDNGitHub 联系邮箱:aikongmeng@gmail.com


Copyright 2008-2019 Government All Rights Reserved