2013年1月27日
摘要: 1 package chapter5方法; 2 //求最大公约数; 3 public class GreatestCommonDivisor { 4 public static void main(String[] args){ 5 java.util.Scanner input = new java.util.Scanner(System.in); 6 7 System.out.print("Enter first integer: "); 8 int n1 = input.nextInt(); 9 ... 阅读全文
posted @ 2013-01-27 19:46 bailun 阅读(1339) 评论(0) 推荐(0) 编辑
摘要: 4.1在A处count<100总是true;在C处count<100总是false;在B处count<100有时是true有时是false4.2guess被初始化为1到100之间的数都是错误的,因为这都是要猜的数。4.3a)和b)循环无数次;c)循环9次输出是3,5,7,9一行输出一个数。4.4publicclasstest3{publicstaticvoidmain(String[]args){java.util.Scannerinput=newjava.util.Scanner(System.in);intsum=0;intnumber;do{System.out.pri 阅读全文
posted @ 2013-01-27 19:42 bailun 阅读(2193) 评论(0) 推荐(0) 编辑
摘要: 1 package chapter4; 2 3 public class FutureTuition { 4 public static void main(String[] args){ 5 double tuition = 10000; 6 int year = 1; 7 while (tuition < 20000){ 8 tuition = tuition * 1.07; 9 year++;10 }11 System.out.println("Tuitio... 阅读全文
posted @ 2013-01-27 19:39 bailun 阅读(2477) 评论(5) 推荐(0) 编辑