题目:古典问题:兔子出生第3月起月生兔子兔**第三月月生兔子假兔子死问月兔子总数少?
菲波拉契数列问题
public class lianxi01 {
public static void main(String[] args) {
Systemoutprintln(第1月兔子数 1)
Systemoutprintln(第2月兔子数 1)
int f1 1 f2 1 f M24
for(int i3 i
f2 f1 + f2
f1 f
Systemoutprintln(第 + i +月兔子数 +f2)
}
}
}
程序2
题目:判断101200间少素数输出素数
程序分析:判断素数方法:数分2sqrt(数)果整 表明数素数反素数
public class lianxi02 {
public static void main(String[] args) {
int count 0
for(int i101 i<200 i+2) {
boolean b false
for(int j2 j
if(i j 0) { b false break }
else { b true }
}
if(b true) {count ++Systemoutprintln(i )}
}
Systemoutprintln( 素数数 + count)
}
}
程序3
题目:印出 水仙花数 谓 水仙花数 指三位数位数字立方等该数身例:153 水仙花数 1531三次方+5三次方+3三次方
public class lianxi03 {
public static void main(String[] args) {
int b1 b2 b3
for(int m101 m<1000 m++) {
b3 m 100
b2 m 100 10
b1 m 10
if((b3*b3*b3 + b2*b2*b2 + b1*b1*b1) m) {
Systemoutprintln(m+水仙花数) }
}
}
}
程序4
题目:正整数分解质数例:输入90印出902*3*3*5
程序分析:n进行分解质数应先找质数k然述步骤完成:
(1)果质数恰等n说明分解质数程已结束印出
(2)果n <> knk整应印出k值nk商作新正整数n重复执行第步
(3)果nk整k+1作k值重复执行第步
import javautil*
public class lianxi04{
public static void main(String[] args) {
Scanner s new Scanner(Systemin)
Systemoutprint( 请键入正整数 )
int n snextInt()
int k2
Systemoutprint(n + )
while(k < n) {
if(k n) {Systemoutprintln(n)break}
else if( n k 0) {Systemoutprint(k + *)n n k }
else k++
}
}
}
程序5
题目:利条件运算符嵌套完成题:学成绩> 90分学A表示6089分间B表示60分C表示
import javautil*
public class lianxi05 {
public static void main(String[] args) {
int x
char grade
Scanner s new Scanner(Systemin)
Systemoutprint( 请输入成绩 )
x snextInt()
grade x > 90 'A'
x > 60 'B'
'C'
Systemoutprintln(等级:+grade)
}
}
程序6
题目:输入两正整数mn求公约数公倍数
**循环中数等0较数较数数作轮循环数取余数作轮循环较数循环直较数值0返回较数数公约数公倍数两数积公约数*
import javautil*
public class lianxi06 {
public static void main(String[] args) {
int a bm
Scanner s new Scanner(Systemin)
Systemoutprint( 键入整数: )
a snextInt()
Systemoutprint( 键入整数: )
b snextInt()
deff cd new deff()
m cddeff(ab)
int n a * b m
Systemoutprintln(公约数 + m)
Systemoutprintln(公倍数 + n)
}
}
class deff{
public int deff(int x int y) {
int t
if(x < y) {
t x
x y
y t
}
while(y 0) {
if(x y) return x
else {
int k x y
x y
y k
}
}
return x
}
}
程序7
题目:输入行字符分统计出中英文字母空格数字字符数
import javautil*
public class lianxi07 {
public static void main(String[] args) {
int digital 0
int character 0
int other 0
int blank 0
char[] ch null
Scanner sc new Scanner(Systemin)
String s scnextLine()
ch stoCharArray()
for(int i0 i
digital ++
} else if((ch > 'a' && ch < 'z') || ch > 'A' && ch < 'Z') {
character ++
} else if(ch ' ') {
blank ++
} else {
other ++
}
}
Systemoutprintln(数字数 + digital)
Systemoutprintln(英文字母数 + character)
Systemoutprintln(空格数 + blank)
Systemoutprintln(字符数 + other )
}
}
程序8
题目:求sa+aa+aaa+aaaa+aaa值中a数字例2+22+222+2222+22222(时5数相加)数相加键盘控制
import javautil*
public class lianxi08 {
public static void main(String[] args) {
long a b 0 sum 0
Scanner s new Scanner(Systemin)
Systemoutprint(输入数字a值: )
a snextInt()
Systemoutprint(输入相加项数:)
int n snextInt()
int i 0
while(i < n) {
b b + a
sum sum + b
a a * 10
++ i
}
Systemoutprintln(sum)
}
}
程序9
题目:数果恰等子数称 完数 例61+2+3编程 找出1000完数
public class lianxi09 {
public static void main(String[] args) {
Systemoutprintln(11000完数: )
for(int i1 i<1000 i++) {
int t 0
for(int j1 j< i2 j++) {
if(i j 0) {
t t + j
}
}
if(t i) {
Systemoutprint(i + )
}
}
}
程序10
题目:球100米高度落次落反跳回原高度半落求 第
10次落时少米?第10次反弹高?
public class lianxi10 {
public static void main(String[] args) {
double h 100s 100
for(int i1 i<10 i++) {
s s + h
h h 2
}
Systemoutprintln(路程: + s)
Systemoutprintln(反弹高度: + h 2)
}
}
程序11
题目:1234四数字组成少互相重复数字三位数?少?
public class lianxi11 {
public static void main(String[] args) {
int count 0
for(int x1 x<5 x++) {
for(int y1 y<5 y++) {
for(int z1 z<5 z++) {
if(x y && y z && x z) {
count ++
Systemoutprintln(x*100 + y*10 + z )
}
}
}
}
Systemoutprintln( + count + 三位数)
}
}
程序12
题目:企业发放奖金根利润提成利润(I)低等10万元时奖金提10利润高10万元低20万元时低10万元部分10提成高10万元部分提成7520万40万间时高20万元部分提成540万60万间时高40万元部分提成360万100万间时高60万元部分提成15高100万元时超100万元部分1提成键盘输入月利润求应发放奖金总数?
import javautil*
public class lianxi12 {
public static void main(String[] args) {
double x 0y 0
Systemoutprint(输入月利润(万):)
Scanner s new Scanner(Systemin)
x snextInt()
if(x > 0 && x < 10) {
y x * 01
} else if(x > 10 && x < 20) {
y 10 * 01 + (x 10) * 0075
} else if(x > 20 && x < 40) {
y 10 * 01 + 10 * 0075 + (x 20) * 005
} else if(x > 40 && x < 60) {
y 10 * 01 + 10 * 0075 + 20 * 005 + (x 40) * 003
} else if(x > 60 && x < 100) {
y 20 * 0175 + 20 * 005 + 20 * 003 + (x 60) * 0015
} else if(x > 100) {
y 20 * 0175 + 40 * 008 + 40 * 0015 + (x 100) * 001
}
Systemoutprintln(应该提取奖金 + y + 万)
}
}
程序13
题目:整数加100完全方数加168完全方数请问该数少?
public class lianxi13 {
public static void main(String[] args) {
for(int x 1 x<100000 x++) {
if(Mathsqrt(x+100) 1 0) {
if(Mathsqrt(x+268) 1 0) {
Systemoutprintln(x + 加100完全方数加168完全方数)
}
}
}
}
}
*题意循环应该100开始(整数包括正整数负整数零)样会满足条件数99
部分解道题目时题中整数理解成正整数流*
程序14
题目:输入某年某月某日判断天年第天?
import javautil*
public class lianxi14 {
public static void main(String[] args) {
int year month day
int days 0
int d 0
int e
input fymd new input()
do {
e 0
Systemoutprint(输入年:)
year fymdinput()
Systemoutprint(输入月:)
month fymdinput()
Systemoutprint(输入天:)
day fymdinput()
if (year < 0 || month < 0 || month > 12 || day < 0 || day > 31) {
Systemoutprintln(输入错误请重新输入)
e1
}
}while( e1)
for (int i1 i
case 1
case 3
case 5
case 7
case 8
case 10
case 12
days 31
break
case 4
case 6
case 9
case 11
days 30
break
case 2
if ((year 400 0) || (year 4 0 && year 100 0)) {
days 29
} else {
days 28
}
break
}
d + days
}
Systemoutprintln(year + + month + + day + 年第 + (d+day) + 天)
}
}
class input{
public int input() {
int value 0
Scanner s new Scanner(Systemin)
value snextInt()
return value
}
}
程序15
题目:输入三整数xyz请三数输出
import javautil*
public class lianxi15 {
public static void main(String[] args) {
input fnc new input()
int x0 y0 z0
Systemoutprint(输入第数字:)
x fncinput()
Systemoutprint(输入第二数字:)
y fncinput()
Systemoutprint(输入第三数字:)
z fncinput()
if(x > y) {
int t x
x y
y t
}
if(x > z) {
int t x
x z
z t
}
if(y > z) {
int t y
y z
z t
}
Systemoutprintln( 三数字排列: +x + + y + + z)
}
}
class input{
public int input() {
int value 0
Scanner s new Scanner(Systemin)
value snextInt()
return value
}
}
程序16
题目:输出9*9口诀
public class lianxi16 {
public static void main(String[] args) {
for(int i1 i<10 i++) {
for(int j1 j Systemoutprint(j + * + i + + j*i + )
if(j*i<10){Systemoutprint( )}
}
Systemoutprintln()
}
}
}
程序17
题目:猴子吃桃问题:猴子第天摘干桃子吃半瘾吃 第二天早剩桃子吃掉半吃天早吃前天剩 半零第10天早想吃时见剩桃子求第天摘少
public class lianxi17 {
public static void main(String[] args) {
int x 1
for(int i2 i<10 i++) {
x (x+1)*2
}
Systemoutprintln(猴子第天摘 + x + 桃子)
}
}
程序18
题目:两乒乓球队进行赛出三甲队abc三乙队xyz三已抽签决定赛名单队员听赛名单a说xc说xz请编程序找出三队赛手名单
public class lianxi18 {
static char[] m { 'a' 'b' 'c' }
static char[] n { 'x' 'y' 'z' }
public static void main(String[] args) {
for (int i 0 i < mlength i++) {
for (int j 0 j < nlength j++) {
if (m[i] 'a' && n[j] 'x') {
continue
} else if (m[i] 'a' && n[j] 'y') {
continue
} else if ((m[i] 'c' && n[j] 'x')
|| (m[i] 'c' && n[j] 'z')) {
continue
} else if ((m[i] 'b' && n[j] 'z')
|| (m[i] 'b' && n[j] 'y')) {
continue
} else
Systemoutprintln(m[i] + vs + n[j])
}
}
}
}
程序19
题目:印出图案(菱形)
*
***
*****
*******
*****
***
*
public class lianxi19 {
public static void main(String[] args) {
int H 7 W 7高宽必须相等奇数
for(int i0 i<(H+1) 2 i++) {
for(int j0 j
}
for(int k1 k<(i+1)*2 k++) {
Systemoutprint('*')
}
Systemoutprintln()
}
for(int i1 i
for(int j1 j Systemoutprint( )
}
for(int k1 k Systemoutprint('*')
}
Systemoutprintln()
}
}
}
程序20
题目:分数序列:213253851382113求出数列前20项
public class lianxi20 {
public static void main(String[] args) {
int x 2 y 1 t
double sum 0
for(int i1 i<20 i++) {
sum sum + (double)x y
t y
y x
x y + t
}
Systemoutprintln(前20项相加: + sum)
}
}
程序21
题目:求1+2+3++20
public class lianxi21 {
public static void main(String[] args) {
long sum 0
long fac 1
for(int i1 i<20 i++) {
fac fac * i
sum + fac
}
Systemoutprintln(sum)
}
}
程序22
题目:利递方法求5
public class lianxi22 {
public static void main(String[] args) {
int n 5
rec fr new rec()
Systemoutprintln(n+ +frrec(n))
}
}
class rec{
public long rec(int n) {
long value 0
if(n 1 ) {
value 1
} else {
value n * rec(n1)
}
return value
}
}
程序23
题目:5坐起问第五少岁?说第42岁问第4岁数说第32岁问第三说第2两岁问第2说第两岁问第说
10岁请问第五?
public class lianxi23 {
public static void main(String[] args) {
int age 10
for(int i2 i<5 i++) {
age age+2
}
Systemoutprintln(age)
}
}
程序24
题目:5位正整数求:求位数二逆序印出位数字
长整型输入18位
import javautil*
public class lianxi24 {
public static void main(String[] args) {
Scanner s new Scanner(Systemin)
Systemoutprint(请输入正整数:)
long a snextLong()
String ss LongtoString(a)
char[] ch sstoCharArray()
int jchlength
Systemoutprintln(a + + j +位数)
Systemoutprint(逆序输出:)
for(int ij1 i>0 i) {
Systemoutprint(ch[i])
}
}
}
程序25
题目:5位数判断回文数12321回文数位万位相十位千位相
import javautil*
public class lianxi25 {
public static void main(String[] args) {
Scanner s new Scanner(Systemin)
int a
do{
Systemoutprint(请输入5位正整数:)
a snextInt()
}while(a<10000||a>99999)
String ss StringvalueOf(a)
char[] ch sstoCharArray()
if(ch[0]ch[4]&&ch[1]ch[3]){
Systemoutprintln(回文数)}
else {Systemoutprintln(回文数)}
}
}
更限位数
import javautil*
public class lianxi25a {
public static void main(String[] args) {
Scanner s new Scanner(Systemin)
boolean is true
Systemoutprint(请输入正整数:)
long a snextLong()
String ss LongtoString(a)
char[] ch sstoCharArray()
int jchlength
for(int i0 i if(ch[i]ch[ji1]){isfalse}
}
if(istrue){Systemoutprintln(回文数)}
else {Systemoutprintln(回文数)}
}
}
程序26
题目:请输入星期第字母判断星期果第字母样继续 判断第二字母
import javautil*
public class lianxi26 {
public static void main(String[] args) {
getChar tw new getChar()
Systemoutprintln(请输入星期第写字母:)
char ch twgetChar()
switch(ch) {
case 'M'
Systemoutprintln(Monday)
break
case 'W'
Systemoutprintln(Wednesday)
break
case 'F'
Systemoutprintln(Friday)
break
case 'T' {
Systemoutprintln(请输入星期第二字母:)
char ch2 twgetChar()
if(ch2 'U') {Systemoutprintln(Tuesday) }
else if(ch2 'H') {Systemoutprintln(Thursday) }
else {Systemoutprintln(写法)
}
}
break
case 'S' {
Systemoutprintln(请输入星期第二字母:)
char ch2 twgetChar()
if(ch2 'U') {Systemoutprintln(Sunday) }
else if(ch2 'A') {Systemoutprintln(Saturday) }
else {Systemoutprintln(写法)
}
}
break
defaultSystemoutprintln(写法)
}
}
}
class getChar{
public char getChar() {
Scanner s new Scanner(Systemin)
String str snextLine()
char ch strcharAt(0)
if(ch<'A' || ch>'Z') {
Systemoutprintln(输入错误请重新输入)
chgetChar()
}
return ch
}
}
程序27
题目:求100素数
sqrt(n)方法求出素数包括23
public class lianxi27 {
public static void main(String[] args) {
boolean b false
Systemoutprint(2 + )
Systemoutprint(3 + )
for(int i3 i<100 i+2) {
for(int j2 j if(i j 0) {b false
break
} else{b true}
}
if(b true) {Systemoutprint(i + )}
}
}
}
该程序1位素数2位方法运行效率高通性差
public class lianxi27a {
public static void main(String[] args) {
int[] a new int[]{2 3 5 7}
for(int j0 j<4 j++)Systemoutprint(a[j] + )
boolean b false
for(int i11 i<100 i+2) {
for(int j0 j<4 j++) {
if(i a[j] 0) {b false
break
} else{b true}
}
if(b true) {Systemoutprint(i + )}
}
}
}
程序28
题目:10数进行排序
import javautil*
public class lianxi28 {
public static void main(String[] args) {
Scanner s new Scanner(Systemin)
int[] a new int[10]
Systemoutprintln(请输入10整数:)
for(int i0 i<10 i++) {
a[i] snextInt()
}
for(int i0 i<10 i++) {
for(int ji+1 j<10 j++) {
if(a[i] > a[j]) {
int t a[i]
a[i] a[j]
a[j] t
}
}
}
for(int i0 i<10 i++) {
Systemoutprint(a[i] + )
}
}
}
程序29
题目:求3*3矩阵角线元素
import javautil*
public class lianxi29 {
public static void main(String[] args) {
Scanner s new Scanner(Systemin)
int[][] a new int[3][3]
Systemoutprintln(请输入9整数:)
for(int i0 i<3 i++) {
for(int j0 j<3 j++) {
a[i][j] snextInt()
}
}
Systemoutprintln(输入3 * 3 矩阵)
for(int i0 i<3 i++) {
for(int j0 j<3 j++) {
Systemoutprint(a[i][j] + )
}
Systemoutprintln()
}
int sum 0
for(int i0 i<3 i++) {
for(int j0 j<3 j++) {
if(i j) {
sum + a[i][j]
}
}
}
Systemoutprintln(角线: + sum)
}
}
程序30
题目:已排序数组现输入数求原规律插入数组中
程序没折半查找插入
import javautil*
public class lianxi30 {
public static void main(String[] args) {
int[] a new int[]{1 2 6 14 25 36 3755}
int[] b new int[alength+1]
int t1 0 t2 0
int i 0
Scanner s new Scanner(Systemin)
Systemoutprint(请输入整数:)
int num snextInt()
if(num > a[alength1]) {
b[blength1] num
for(i0 i b[i] a[i]
}
} else {
for(i0 i if(num > a[i]) {
b[i] a[i]
} else {
b[i] num
break
}
}
for(int ji+1 j b[j] a[j1]
}
}
for (i 0 i < blength i++) {
Systemoutprint(b[i] + )
}
}
}
程序31
题目:数组逆序输出
import javautil*
public class lianxi31 {
public static void main(String[] args) {
Scanner s new Scanner(Systemin)
int a[] new int[20]
Systemoutprintln(请输入正整数(输入1表示结束):)
int i0j
do{
a[i]snextInt()
i++
}while (a[i1]1)
Systemoutprintln(输入数组:)
for( j0 j Systemoutprint(a[j]+ )
}
Systemoutprintln(\n数组逆序输出:)
for( ji2 j>0 jj1) {
Systemoutprint(a[j]+ )
}
}
}
程序32
题目:取整数a右端开始4~7位
import javautil*
public class lianxi32 {
public static void main(String[] args) {
Scanner s new Scanner(Systemin)
Systemoutprint(请输入7位正整数:)
long a snextLong()
String ss LongtoString(a)
char[] ch sstoCharArray()
int jchlength
if (j<7){Systemoutprintln(输入错误)}
else {
Systemoutprintln(截取右端开始4~7位:+ch[j7]+ch[j6]+ch[j5]+ch[j4])
}
}
}
程序33
题目:印出杨辉三角形(求印出10行图)
1
1 1
1 2 1
1 3 3 1
1 4 6 4 1
1 5 10 10 5 1
…………
public class lianxi33 {
public static void main(String[] args) {
int[][] a new int[10][10]
for(int i0 i<10 i++) {
a[i][i] 1
a[i][0] 1
}
for(int i2 i<10 i++) {
for(int j1 j a[i][j] a[i1][j1] + a[i1][j]
}
}
for(int i0 i<10 i++) {
for(int k0 k<2*(10i)1 k++) {
Systemoutprint( )
}
for(int j0 j Systemoutprint(a[i][j] + )
}
Systemoutprintln()
}
}
}
程序34
题目:输入3数abc序输出
import javautilScanner
public class lianxi34 {
public static void main(String[] args) {
Scanner s new Scanner(Systemin)
Systemoutprintln(请输入3整数:)
int a snextInt()
int b snextInt()
int c snextInt()
if(a < b) {
int t a
a b
b t
}
if(a < c) {
int t a
a c
c t
}
if(b < c) {
int t b
b c
c t
}
Systemoutprintln(序输出)
Systemoutprintln(a + + b + + c)
}
}
程序35
题目:输入数组第元素交换元素交换输出数组
import javautil*
public class lianxi35 {
public static void main(String[] args) {
int N 8
int[] a new int [N]
Scanner s new Scanner(Systemin)
int idx1 0 idx2 0
Systemoutprintln(请输入8整数:)
for(int i0 i a[i] snextInt()
}
Systemoutprintln(输入数组:)
for(int i0 i Systemoutprint(a[i] + )
}
int max a[0] min a[0]
for(int i0 i if(a[i] > max) {
max a[i]
idx1 i
}
if(a[i] < min) {
min a[i]
idx2 i
}
}
if(idx1 0) {
int temp a[0]
a[0] a[idx1]
a[idx1] temp
}
if(idx2 N1) {
int temp a[N1]
a[N1] a[idx2]
a[idx2] temp
}
Systemoutprintln(\n交换数组:)
for(int i0 i Systemoutprint(a[i] + )
}
}
}
程序36
题目:n整数前面数序移m位置m数变成前面m数
import javautilScanner
public class lianxi36 {
public static void main(String[] args) {
int N 10
int[] a new int[N]
Scanner s new Scanner(Systemin)
Systemoutprintln(请输入10整数:)
for(int i0 i a[i] snextInt()
}
Systemoutprint(输入数组:)
for(int i0 i Systemoutprint(a[i] + )
}
Systemoutprint(\n请输入移动位数:)
int m snextInt()
int[] b new int[m]
for(int i0 i b[i] a[Nm+i]
}
for(int iN1 i>m i) {
a[i] a[im]
}
for(int i0 i a[i] b[i]
}
Systemoutprint(位移数组:)
for(int i0 i Systemoutprint(a[i] + )
}
}
}
程序37
题目:n围成圈序排号第开始报数(13报数)报3退出圈子问留原第号位
import javautilScanner
public class lianxi37 {
public static void main(String[] args) {
Scanner s new Scanner(Systemin)
Systemoutprint(请输入排成圈数:)
int n snextInt()
boolean[] arr new boolean[n]
for(int i0 i arr[i] true
}
int leftCount n
int countNum 0
int index 0
while(leftCount > 1) {
if(arr[index] true) {
countNum ++
if(countNum 3) {
countNum 0
arr[index] false
leftCount
}
}
index ++
if(index n) {
index 0
}
}
for(int i0 i if(arr[i] true) {
Systemoutprintln(原排第+(i+1)+位留)
}
}
}
}
程序38
题目:写函数求字符串长度main函数中输入字符串输出长度
*………………
*……题目意思似length()函数 *
import javautil*
public class lianxi38 {
public static void main(String[] args) {
Scanner s new Scanner(Systemin)
Systemoutprintln(请输入字符串:)
String str snextLine()
Systemoutprintln(字符串长度:+strlength())
}
}
程序39
题目:编写函数输入n偶数时调函数求12+14++1n输入n奇数时调函数11+13++1n(利指针函数)
没利指针函数
import javautil*
public class lianxi39 {
public static void main(String[] args) {
Scanner s new Scanner(Systemin)
Systemoutprint(请输入正整数 n )
int n snextInt()
Systemoutprintln(相应数列: + sum(n))
}
public static double sum(int n) {
double res 0
if(n 2 0) {
for(int i2 i res + (double)1 i
}
} else {
for(int i1 i res + (double)1 i
}
}
return res
}
}
程序40
题目:字符串排序
public class lianxi40 {
public static void main(String[] args) {
int N5
String temp null
String[] s new String[N]
s[0] matter
s[1] state
s[2] solid
s[3] liquid
s[4] gas
for(int i0 i for(int ji+1 j if(compare(s[i] s[j]) false) {
temp s[i]
s[i] s[j]
s[j] temp
}
}
}
for(int i0 i Systemoutprintln(s[i])
}
}
static boolean compare(String s1 String s2) {
boolean result true
for(int i0 i if(s1charAt(i) > s2charAt(i)) {
result false
break
} else if(s1charAt(i) result true
break
} else {
if(s1length() < s2length()) {
result true
} else {
result false
}
}
}
return result
}
}
程序41
题目:海滩堆桃子五猴子分第猴子堆桃子分五份猴子扔入海中走份第二猴子剩桃子均分成五份样扔入海中走份第三第四第五猴子样做问海滩原少少桃子?
public class lianxi41 {
public static void main (String[] args) {
int imj0kcount
for(i4i<10000i+4)
{ count0
mi
for(k0k<5k++)
{
ji4*5+1
ij
if(j40)
count++
else break
}
im
if(count4)
{Systemoutprintln(原桃子 +j+ )
break}
}
}
}
程序42
题目:809*800*+9*+1 中代表两位数8*结果两位数9*结果3位数求代表两位数809*结果
题目错809x800x+9x+1 样方程解掉1解
public class lianxi42 {
public static void main (String[] args) {
int a809bi
for(i10i<13i++)
{bi*a
if(8*i<100&&9*i>100)
Systemoutprintln (809*+i++800*+i+++9*+i++b)}
}
}
程序43
题目:求0—7组成奇数数
组成1位数4
组成2位数7*4
组成3位数7*8*4
组成4位数7*8*8*4
public class lianxi43 {
public static void main (String[] args) {
int sum4
int j
Systemoutprintln(组成1位数 +sum+ )
sumsum*7
Systemoutprintln(组成2位数 +sum+ )
for(j3j<9j++){
sumsum*8
Systemoutprintln(组成+j+位数 +sum+ )
}
}
}
程序44
题目:偶数总表示两素数
sqrt(n)方法求出素数包括23
判断否素数程序中添加3
import javautil*
public class lianxi44 {
public static void main(String[] args) {
Scanner s new Scanner(Systemin)
int ni
do{
Systemoutprint(请输入等6偶数:)
n snextInt()
} while(n<6||n20) 判断输入否>6偶数重新输入
fun fc new fun()
for(i2i if((fcfun(i))1&&(fcfun(ni)1))
{int jni
Systemoutprintln(n+ +i+ + +j)
} 输出素数
}
}
}
class fun{
public int fun (int a) 判断否素数函数
{
int iflag0
if(a3){flag1return(flag)}
for(i2i if(ai0) {flag0break}
else flag1}
return (flag) 素数返回0素数返回1
}
}
解法二
import javautil*
public class lianxi44 {
public static void main(String[] args) {
Scanner s new Scanner(Systemin)
int n
do{
Systemoutprint(请输入等6偶数:)
n snextInt()
} while(n<6||n20) 判断输入否>6偶数重新输入
for(int i3i if(fun(i)&&fun(ni)) {
Systemoutprintln(n+ +i+ + +(ni))
} 输出素数
}
}
static boolean fun (int a){ 判断否素数函数
boolean flagfalse
if(a3){flagtruereturn(flag)}
for(int i2i if(ai0) {flagfalsebreak}
else flagtrue}
return (flag)
}
}
程序45
题目:判断素数9整
题目错吧?9整素数改成整数
import javautil*
public class lianxi45 {
public static void main (String[] args) {
Scanner s new Scanner(Systemin)
Systemoutprint(请输入整数:)
int num snextInt()
int tmp num
int count 0
for(int i 0 tmp9 0 ){
tmp tmp9
count ++
}
Systemoutprintln(num+ 够 +count+ 9整)
}
}
程序46
题目:两字符串连接程序
import javautil*
public class lianxi46 {
public static void main(String[] args) {
Scanner s new Scanner(Systemin)
Systemoutprint(请输入字符串:)
String str1 snextLine()
Systemoutprint(请输入字符串:)
String str2 snextLine()
String str str1+str2
Systemoutprintln(连接字符串:+str)
}
}
程序47
题目:读取7数(1—50)整数值读取值程序印出该值数*
import javautil*
public class lianxi47 {
public static void main(String[] args) {
Scanner s new Scanner(Systemin)
int n1num
while(n<7){
do{
Systemoutprint(请输入150间整数:)
num snextInt()
}while(num<1||num>50)
for(int i1i {Systemoutprint(*)
}
Systemoutprintln()
n ++
}
}
}
程序48
题目:某公司采公电话传递数数四位整数传递程中加密加密规:位数字加5然10余数代该数字第位第四位交换第二位第三位交换
import javautil*
public class lianxi48 {
public static void main(String args[]) {
Scanner s new Scanner(Systemin)
int num0temp
do{
Systemoutprint(请输入4位正整数:)
num snextInt()
}while (num<1000||num>9999)
int a[]new int[4]
a[0] num1000 取千位数字
a[1] (num100)10 取百位数字
a[2] (num10)10 取十位数字
a[3] num10 取位数字
for(int j0j<4j++)
{
a[j]+5
a[j]10
}
for(int j0j<1j++)
{
temp a[j]
a[j] a[3j]
a[3j] temp
}
Systemoutprint(加密数字:)
for(int j0j<4j++)
Systemoutprint(a[j])
}
}
程序49
题目:计算字符串中子串出现次数
import javautil*
public class lianxi49 {
public static void main(String args[]){
Scanner s new Scanner(Systemin)
Systemoutprint(请输入字符串:)
String str1 snextLine()
Systemoutprint(请输入子串:)
String str2 snextLine()
int count0
if(str1equals()||str2equals())
{
Systemoutprintln(没输入字符串子串法较)
Systemexit(0)
}
else
{
for(int i0i {
if(str2equals(str1substring(i str2length()+i)))
种法问题会aaa成2aa子串
count++
}
Systemoutprintln(子串字符串中出现 +count+ 次)
}
}
}
程序50
题目:五学生学生3门课成绩键盘输入数(包括学生号姓名**课成绩)计算出均成绩原数计算出均分数存放磁盘文件 stud 中
import javaio*
import javautil*
public class lianxi50 {
public static void main(String[] args){
Scanner ss new Scanner(Systemin)
String [][] a new String[5][6]
for(int i1 i<6 i++) {
Systemoutprint(请输入第+i+学生学号:)
a[i1][0] ssnextLine()
Systemoutprint(请输入第+i+学生姓名:)
a[i1][1] ssnextLine()
for(int j1 j<4 j++) {
Systemoutprint(请输入该学生第+j+成绩:)
a[i1][j+1] ssnextLine()
}
Systemoutprintln(\n)
}
计算均分
float avg
int sum
for(int i0 i<5 i++) {
sum0
for(int j2 j<5 j++) {
sumsum+ IntegerparseInt(a[i][j])
}
avg (float)sum3
a[i][5]StringvalueOf(avg)
}
写磁盘文件
String s1
try {
File f new File(C\\stud)
if(fexists()){
Systemoutprintln(文件存)
}else{
Systemoutprintln(文件存正创建文件)
fcreateNewFile()存创建
}
BufferedWriter output new BufferedWriter(new FileWriter(f))
for(int i0 i<5 i++) {
for(int j0 j<6 j++) {
s1a[i][j]+\r\n
outputwrite(s1)
}
}
outputclose()
Systemoutprintln(数已写入c盘文件stud中)
} catch (Exception e) {
eprintStackTrace()
}
}
}
文香网httpwwwxiangdangnet
《香当网》用户分享的内容,不代表《香当网》观点或立场,请自行判断内容的真实性和可靠性!
该内容是文档的文本内容,更好的格式请下载文档
}
Systemoutprintln()
}
}
}
程序20
题目:分数序列:213253851382113求出数列前20项
public class lianxi20 {
public static void main(String[] args) {
int x 2 y 1 t
double sum 0
for(int i1 i<20 i++) {
sum sum + (double)x y
t y
y x
x y + t
}
Systemoutprintln(前20项相加: + sum)
}
}
程序21
题目:求1+2+3++20
public class lianxi21 {
public static void main(String[] args) {
long sum 0
long fac 1
for(int i1 i<20 i++) {
fac fac * i
sum + fac
}
Systemoutprintln(sum)
}
}
程序22
题目:利递方法求5
public class lianxi22 {
public static void main(String[] args) {
int n 5
rec fr new rec()
Systemoutprintln(n+ +frrec(n))
}
}
class rec{
public long rec(int n) {
long value 0
if(n 1 ) {
value 1
} else {
value n * rec(n1)
}
return value
}
}
程序23
题目:5坐起问第五少岁?说第42岁问第4岁数说第32岁问第三说第2两岁问第2说第两岁问第说
10岁请问第五?
public class lianxi23 {
public static void main(String[] args) {
int age 10
for(int i2 i<5 i++) {
age age+2
}
Systemoutprintln(age)
}
}
程序24
题目:5位正整数求:求位数二逆序印出位数字
长整型输入18位
import javautil*
public class lianxi24 {
public static void main(String[] args) {
Scanner s new Scanner(Systemin)
Systemoutprint(请输入正整数:)
long a snextLong()
String ss LongtoString(a)
char[] ch sstoCharArray()
int jchlength
Systemoutprintln(a + + j +位数)
Systemoutprint(逆序输出:)
for(int ij1 i>0 i) {
Systemoutprint(ch[i])
}
}
}
程序25
题目:5位数判断回文数12321回文数位万位相十位千位相
import javautil*
public class lianxi25 {
public static void main(String[] args) {
Scanner s new Scanner(Systemin)
int a
do{
Systemoutprint(请输入5位正整数:)
a snextInt()
}while(a<10000||a>99999)
String ss StringvalueOf(a)
char[] ch sstoCharArray()
if(ch[0]ch[4]&&ch[1]ch[3]){
Systemoutprintln(回文数)}
else {Systemoutprintln(回文数)}
}
}
更限位数
import javautil*
public class lianxi25a {
public static void main(String[] args) {
Scanner s new Scanner(Systemin)
boolean is true
Systemoutprint(请输入正整数:)
long a snextLong()
String ss LongtoString(a)
char[] ch sstoCharArray()
int jchlength
for(int i0 i
}
if(istrue){Systemoutprintln(回文数)}
else {Systemoutprintln(回文数)}
}
}
程序26
题目:请输入星期第字母判断星期果第字母样继续 判断第二字母
import javautil*
public class lianxi26 {
public static void main(String[] args) {
getChar tw new getChar()
Systemoutprintln(请输入星期第写字母:)
char ch twgetChar()
switch(ch) {
case 'M'
Systemoutprintln(Monday)
break
case 'W'
Systemoutprintln(Wednesday)
break
case 'F'
Systemoutprintln(Friday)
break
case 'T' {
Systemoutprintln(请输入星期第二字母:)
char ch2 twgetChar()
if(ch2 'U') {Systemoutprintln(Tuesday) }
else if(ch2 'H') {Systemoutprintln(Thursday) }
else {Systemoutprintln(写法)
}
}
break
case 'S' {
Systemoutprintln(请输入星期第二字母:)
char ch2 twgetChar()
if(ch2 'U') {Systemoutprintln(Sunday) }
else if(ch2 'A') {Systemoutprintln(Saturday) }
else {Systemoutprintln(写法)
}
}
break
defaultSystemoutprintln(写法)
}
}
}
class getChar{
public char getChar() {
Scanner s new Scanner(Systemin)
String str snextLine()
char ch strcharAt(0)
if(ch<'A' || ch>'Z') {
Systemoutprintln(输入错误请重新输入)
chgetChar()
}
return ch
}
}
程序27
题目:求100素数
sqrt(n)方法求出素数包括23
public class lianxi27 {
public static void main(String[] args) {
boolean b false
Systemoutprint(2 + )
Systemoutprint(3 + )
for(int i3 i<100 i+2) {
for(int j2 j
break
} else{b true}
}
if(b true) {Systemoutprint(i + )}
}
}
}
该程序1位素数2位方法运行效率高通性差
public class lianxi27a {
public static void main(String[] args) {
int[] a new int[]{2 3 5 7}
for(int j0 j<4 j++)Systemoutprint(a[j] + )
boolean b false
for(int i11 i<100 i+2) {
for(int j0 j<4 j++) {
if(i a[j] 0) {b false
break
} else{b true}
}
if(b true) {Systemoutprint(i + )}
}
}
}
程序28
题目:10数进行排序
import javautil*
public class lianxi28 {
public static void main(String[] args) {
Scanner s new Scanner(Systemin)
int[] a new int[10]
Systemoutprintln(请输入10整数:)
for(int i0 i<10 i++) {
a[i] snextInt()
}
for(int i0 i<10 i++) {
for(int ji+1 j<10 j++) {
if(a[i] > a[j]) {
int t a[i]
a[i] a[j]
a[j] t
}
}
}
for(int i0 i<10 i++) {
Systemoutprint(a[i] + )
}
}
}
程序29
题目:求3*3矩阵角线元素
import javautil*
public class lianxi29 {
public static void main(String[] args) {
Scanner s new Scanner(Systemin)
int[][] a new int[3][3]
Systemoutprintln(请输入9整数:)
for(int i0 i<3 i++) {
for(int j0 j<3 j++) {
a[i][j] snextInt()
}
}
Systemoutprintln(输入3 * 3 矩阵)
for(int i0 i<3 i++) {
for(int j0 j<3 j++) {
Systemoutprint(a[i][j] + )
}
Systemoutprintln()
}
int sum 0
for(int i0 i<3 i++) {
for(int j0 j<3 j++) {
if(i j) {
sum + a[i][j]
}
}
}
Systemoutprintln(角线: + sum)
}
}
程序30
题目:已排序数组现输入数求原规律插入数组中
程序没折半查找插入
import javautil*
public class lianxi30 {
public static void main(String[] args) {
int[] a new int[]{1 2 6 14 25 36 3755}
int[] b new int[alength+1]
int t1 0 t2 0
int i 0
Scanner s new Scanner(Systemin)
Systemoutprint(请输入整数:)
int num snextInt()
if(num > a[alength1]) {
b[blength1] num
for(i0 i
}
} else {
for(i0 i
b[i] a[i]
} else {
b[i] num
break
}
}
for(int ji+1 j
}
}
for (i 0 i < blength i++) {
Systemoutprint(b[i] + )
}
}
}
程序31
题目:数组逆序输出
import javautil*
public class lianxi31 {
public static void main(String[] args) {
Scanner s new Scanner(Systemin)
int a[] new int[20]
Systemoutprintln(请输入正整数(输入1表示结束):)
int i0j
do{
a[i]snextInt()
i++
}while (a[i1]1)
Systemoutprintln(输入数组:)
for( j0 j
}
Systemoutprintln(\n数组逆序输出:)
for( ji2 j>0 jj1) {
Systemoutprint(a[j]+ )
}
}
}
程序32
题目:取整数a右端开始4~7位
import javautil*
public class lianxi32 {
public static void main(String[] args) {
Scanner s new Scanner(Systemin)
Systemoutprint(请输入7位正整数:)
long a snextLong()
String ss LongtoString(a)
char[] ch sstoCharArray()
int jchlength
if (j<7){Systemoutprintln(输入错误)}
else {
Systemoutprintln(截取右端开始4~7位:+ch[j7]+ch[j6]+ch[j5]+ch[j4])
}
}
}
程序33
题目:印出杨辉三角形(求印出10行图)
1
1 1
1 2 1
1 3 3 1
1 4 6 4 1
1 5 10 10 5 1
…………
public class lianxi33 {
public static void main(String[] args) {
int[][] a new int[10][10]
for(int i0 i<10 i++) {
a[i][i] 1
a[i][0] 1
}
for(int i2 i<10 i++) {
for(int j1 j a[i][j] a[i1][j1] + a[i1][j]
}
}
for(int i0 i<10 i++) {
for(int k0 k<2*(10i)1 k++) {
Systemoutprint( )
}
for(int j0 j Systemoutprint(a[i][j] + )
}
Systemoutprintln()
}
}
}
程序34
题目:输入3数abc序输出
import javautilScanner
public class lianxi34 {
public static void main(String[] args) {
Scanner s new Scanner(Systemin)
Systemoutprintln(请输入3整数:)
int a snextInt()
int b snextInt()
int c snextInt()
if(a < b) {
int t a
a b
b t
}
if(a < c) {
int t a
a c
c t
}
if(b < c) {
int t b
b c
c t
}
Systemoutprintln(序输出)
Systemoutprintln(a + + b + + c)
}
}
程序35
题目:输入数组第元素交换元素交换输出数组
import javautil*
public class lianxi35 {
public static void main(String[] args) {
int N 8
int[] a new int [N]
Scanner s new Scanner(Systemin)
int idx1 0 idx2 0
Systemoutprintln(请输入8整数:)
for(int i0 i
}
Systemoutprintln(输入数组:)
for(int i0 i
}
int max a[0] min a[0]
for(int i0 i
max a[i]
idx1 i
}
if(a[i] < min) {
min a[i]
idx2 i
}
}
if(idx1 0) {
int temp a[0]
a[0] a[idx1]
a[idx1] temp
}
if(idx2 N1) {
int temp a[N1]
a[N1] a[idx2]
a[idx2] temp
}
Systemoutprintln(\n交换数组:)
for(int i0 i
}
}
}
程序36
题目:n整数前面数序移m位置m数变成前面m数
import javautilScanner
public class lianxi36 {
public static void main(String[] args) {
int N 10
int[] a new int[N]
Scanner s new Scanner(Systemin)
Systemoutprintln(请输入10整数:)
for(int i0 i
}
Systemoutprint(输入数组:)
for(int i0 i
}
Systemoutprint(\n请输入移动位数:)
int m snextInt()
int[] b new int[m]
for(int i0 i
}
for(int iN1 i>m i) {
a[i] a[im]
}
for(int i0 i
}
Systemoutprint(位移数组:)
for(int i0 i
}
}
}
程序37
题目:n围成圈序排号第开始报数(13报数)报3退出圈子问留原第号位
import javautilScanner
public class lianxi37 {
public static void main(String[] args) {
Scanner s new Scanner(Systemin)
Systemoutprint(请输入排成圈数:)
int n snextInt()
boolean[] arr new boolean[n]
for(int i0 i
}
int leftCount n
int countNum 0
int index 0
while(leftCount > 1) {
if(arr[index] true) {
countNum ++
if(countNum 3) {
countNum 0
arr[index] false
leftCount
}
}
index ++
if(index n) {
index 0
}
}
for(int i0 i
Systemoutprintln(原排第+(i+1)+位留)
}
}
}
}
程序38
题目:写函数求字符串长度main函数中输入字符串输出长度
*………………
*……题目意思似length()函数 *
import javautil*
public class lianxi38 {
public static void main(String[] args) {
Scanner s new Scanner(Systemin)
Systemoutprintln(请输入字符串:)
String str snextLine()
Systemoutprintln(字符串长度:+strlength())
}
}
程序39
题目:编写函数输入n偶数时调函数求12+14++1n输入n奇数时调函数11+13++1n(利指针函数)
没利指针函数
import javautil*
public class lianxi39 {
public static void main(String[] args) {
Scanner s new Scanner(Systemin)
Systemoutprint(请输入正整数 n )
int n snextInt()
Systemoutprintln(相应数列: + sum(n))
}
public static double sum(int n) {
double res 0
if(n 2 0) {
for(int i2 i
}
} else {
for(int i1 i
}
}
return res
}
}
程序40
题目:字符串排序
public class lianxi40 {
public static void main(String[] args) {
int N5
String temp null
String[] s new String[N]
s[0] matter
s[1] state
s[2] solid
s[3] liquid
s[4] gas
for(int i0 i
temp s[i]
s[i] s[j]
s[j] temp
}
}
}
for(int i0 i
}
}
static boolean compare(String s1 String s2) {
boolean result true
for(int i0 i
result false
break
} else if(s1charAt(i)
break
} else {
if(s1length() < s2length()) {
result true
} else {
result false
}
}
}
return result
}
}
程序41
题目:海滩堆桃子五猴子分第猴子堆桃子分五份猴子扔入海中走份第二猴子剩桃子均分成五份样扔入海中走份第三第四第五猴子样做问海滩原少少桃子?
public class lianxi41 {
public static void main (String[] args) {
int imj0kcount
for(i4i<10000i+4)
{ count0
mi
for(k0k<5k++)
{
ji4*5+1
ij
if(j40)
count++
else break
}
im
if(count4)
{Systemoutprintln(原桃子 +j+ )
break}
}
}
}
程序42
题目:809*800*+9*+1 中代表两位数8*结果两位数9*结果3位数求代表两位数809*结果
题目错809x800x+9x+1 样方程解掉1解
public class lianxi42 {
public static void main (String[] args) {
int a809bi
for(i10i<13i++)
{bi*a
if(8*i<100&&9*i>100)
Systemoutprintln (809*+i++800*+i+++9*+i++b)}
}
}
程序43
题目:求0—7组成奇数数
组成1位数4
组成2位数7*4
组成3位数7*8*4
组成4位数7*8*8*4
public class lianxi43 {
public static void main (String[] args) {
int sum4
int j
Systemoutprintln(组成1位数 +sum+ )
sumsum*7
Systemoutprintln(组成2位数 +sum+ )
for(j3j<9j++){
sumsum*8
Systemoutprintln(组成+j+位数 +sum+ )
}
}
}
程序44
题目:偶数总表示两素数
sqrt(n)方法求出素数包括23
判断否素数程序中添加3
import javautil*
public class lianxi44 {
public static void main(String[] args) {
Scanner s new Scanner(Systemin)
int ni
do{
Systemoutprint(请输入等6偶数:)
n snextInt()
} while(n<6||n20) 判断输入否>6偶数重新输入
fun fc new fun()
for(i2i
{int jni
Systemoutprintln(n+ +i+ + +j)
} 输出素数
}
}
}
class fun{
public int fun (int a) 判断否素数函数
{
int iflag0
if(a3){flag1return(flag)}
for(i2i
else flag1}
return (flag) 素数返回0素数返回1
}
}
解法二
import javautil*
public class lianxi44 {
public static void main(String[] args) {
Scanner s new Scanner(Systemin)
int n
do{
Systemoutprint(请输入等6偶数:)
n snextInt()
} while(n<6||n20) 判断输入否>6偶数重新输入
for(int i3i
Systemoutprintln(n+ +i+ + +(ni))
} 输出素数
}
}
static boolean fun (int a){ 判断否素数函数
boolean flagfalse
if(a3){flagtruereturn(flag)}
for(int i2i
else flagtrue}
return (flag)
}
}
程序45
题目:判断素数9整
题目错吧?9整素数改成整数
import javautil*
public class lianxi45 {
public static void main (String[] args) {
Scanner s new Scanner(Systemin)
Systemoutprint(请输入整数:)
int num snextInt()
int tmp num
int count 0
for(int i 0 tmp9 0 ){
tmp tmp9
count ++
}
Systemoutprintln(num+ 够 +count+ 9整)
}
}
程序46
题目:两字符串连接程序
import javautil*
public class lianxi46 {
public static void main(String[] args) {
Scanner s new Scanner(Systemin)
Systemoutprint(请输入字符串:)
String str1 snextLine()
Systemoutprint(请输入字符串:)
String str2 snextLine()
String str str1+str2
Systemoutprintln(连接字符串:+str)
}
}
程序47
题目:读取7数(1—50)整数值读取值程序印出该值数*
import javautil*
public class lianxi47 {
public static void main(String[] args) {
Scanner s new Scanner(Systemin)
int n1num
while(n<7){
do{
Systemoutprint(请输入150间整数:)
num snextInt()
}while(num<1||num>50)
for(int i1i
}
Systemoutprintln()
n ++
}
}
}
程序48
题目:某公司采公电话传递数数四位整数传递程中加密加密规:位数字加5然10余数代该数字第位第四位交换第二位第三位交换
import javautil*
public class lianxi48 {
public static void main(String args[]) {
Scanner s new Scanner(Systemin)
int num0temp
do{
Systemoutprint(请输入4位正整数:)
num snextInt()
}while (num<1000||num>9999)
int a[]new int[4]
a[0] num1000 取千位数字
a[1] (num100)10 取百位数字
a[2] (num10)10 取十位数字
a[3] num10 取位数字
for(int j0j<4j++)
{
a[j]+5
a[j]10
}
for(int j0j<1j++)
{
temp a[j]
a[j] a[3j]
a[3j] temp
}
Systemoutprint(加密数字:)
for(int j0j<4j++)
Systemoutprint(a[j])
}
}
程序49
题目:计算字符串中子串出现次数
import javautil*
public class lianxi49 {
public static void main(String args[]){
Scanner s new Scanner(Systemin)
Systemoutprint(请输入字符串:)
String str1 snextLine()
Systemoutprint(请输入子串:)
String str2 snextLine()
int count0
if(str1equals()||str2equals())
{
Systemoutprintln(没输入字符串子串法较)
Systemexit(0)
}
else
{
for(int i0i
if(str2equals(str1substring(i str2length()+i)))
种法问题会aaa成2aa子串
count++
}
Systemoutprintln(子串字符串中出现 +count+ 次)
}
}
}
程序50
题目:五学生学生3门课成绩键盘输入数(包括学生号姓名**课成绩)计算出均成绩原数计算出均分数存放磁盘文件 stud 中
import javaio*
import javautil*
public class lianxi50 {
public static void main(String[] args){
Scanner ss new Scanner(Systemin)
String [][] a new String[5][6]
for(int i1 i<6 i++) {
Systemoutprint(请输入第+i+学生学号:)
a[i1][0] ssnextLine()
Systemoutprint(请输入第+i+学生姓名:)
a[i1][1] ssnextLine()
for(int j1 j<4 j++) {
Systemoutprint(请输入该学生第+j+成绩:)
a[i1][j+1] ssnextLine()
}
Systemoutprintln(\n)
}
计算均分
float avg
int sum
for(int i0 i<5 i++) {
sum0
for(int j2 j<5 j++) {
sumsum+ IntegerparseInt(a[i][j])
}
avg (float)sum3
a[i][5]StringvalueOf(avg)
}
写磁盘文件
String s1
try {
File f new File(C\\stud)
if(fexists()){
Systemoutprintln(文件存)
}else{
Systemoutprintln(文件存正创建文件)
fcreateNewFile()存创建
}
BufferedWriter output new BufferedWriter(new FileWriter(f))
for(int i0 i<5 i++) {
for(int j0 j<6 j++) {
s1a[i][j]+\r\n
outputwrite(s1)
}
}
outputclose()
Systemoutprintln(数已写入c盘文件stud中)
} catch (Exception e) {
eprintStackTrace()
}
}
}
文香网httpwwwxiangdangnet
《香当网》用户分享的内容,不代表《香当网》观点或立场,请自行判断内容的真实性和可靠性!
该内容是文档的文本内容,更好的格式请下载文档