// 利用条件运算符的嵌套来完成此题:学习成绩> =90分的同学用A表示,60-89分之间的用B表示,60分以下的用C表示。 //求s=a+aa+aaa+aaaa+aa...a的值,其中a是一个数字。 //例如2+22+222+2222+22222(此时共有5个数相加),几个数相加由用户控制。 // ...
分类:
编程语言 时间:
2016-05-16 09:25:37
阅读次数:
175
String str = "asdfghjkl"; String str1 = "asd"; // 通过首位字母的索引比较 if (str.indexOf("asd") == 0) { System.out.println("true"); } String str2 = "jkl"; if (st ...
分类:
编程语言 时间:
2016-05-13 23:06:37
阅读次数:
250
String str="abcdefghigklmnopqrstuvwxyzABCDEFGHIGKLMNOPQRSTUVWXYZ0123456789"; Random r=new Random(); String arr[]=new String [4]; String b=""; for(int ...
分类:
编程语言 时间:
2016-05-13 13:13:09
阅读次数:
147
Random r=new Random(); int a []=new int[6]; for (int i=0;i<a.length;i++) { int n=r.nextInt(36); a[i]=n+1; for(int j=0;j<i;j++) { if(a[i]==a[j]) { i=i- ...
分类:
编程语言 时间:
2016-05-11 15:06:24
阅读次数:
177
double dn=0; double jc=1; for(int a=1;a<=20;a++) { jc*=a; dn=dn+1/jc; } System.out.println(dn); ...
分类:
编程语言 时间:
2016-05-09 14:11:18
阅读次数:
936
int a=1; for(int b=1;b<=5;b++) { a*=b; } System.out.println(a); ...
分类:
编程语言 时间:
2016-05-09 14:10:27
阅读次数:
1514
package com.hanqi; import java.util.Scanner; public class Lianxiti{ public static void main(String[] args) { // TODO 自动生成的方法存根 //题目一:打印出所有的 "水仙花数 ",所谓 ...
分类:
编程语言 时间:
2016-05-08 11:36:14
阅读次数:
310
1:
/**
* 题目:古典问题:有一对兔子,从出生后第3个月起每个月都生一对兔子, 小兔子长到第三个月后每个月又生一对兔子, 假如兔子都不死,问每个月的兔子对数为多少?
* 程序分析: 兔子的规律为数列1,1,2,3,5,8,13,21....
*
* @author super
*
*/
public class Test {
public static void main...
分类:
编程语言 时间:
2016-04-17 22:44:48
阅读次数:
248