ÉèΪÊ×Ò³ ¼ÓÈëÊÕ²Ø

TOP

×îÐÂJAVA±à³ÌÌâÈ«¼¯_50Ìâ¼°´ð°¸(Îå)
2014-11-24 02:23:10 ¡¾´ó ÖРС¡¿ ä¯ÀÀ:4411´Î
Tags£º×îРJAVA ±à³Ì È«¼¯ _50 ´ð°¸
£¬¶þ¡¢ÄæÐò´òÓ¡³ö¸÷λÊý×Ö¡£
//ʹÓÃÁ˳¤ÕûÐÍ×î¶àÊäÈë18λ
import java.util.*;
public class lianxi24 {
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
System.out.print(¡°ÇëÊäÈëÒ»¸öÕýÕûÊý£º¡±);
long a = s.nextLong();
String ss = Long.toString(a);
char[] ch = ss.toCharArray();
int j=ch.length;
System.out.println(a + ¡°ÊÇÒ»¸ö¡±+ j +¡±Î»Êý¡£¡±);
System.out.print(¡°°´ÄæÐòÊä³öÊÇ£º¡±);
for(int i=j-1; i>=0; i¨C) {
System.out.print(ch[i]);
} } }
¡¾³ÌÐò25¡¿
ÌâÄ¿£ºÒ»¸ö5λÊý£¬ÅжÏËüÊDz»ÊÇ»ØÎÄÊý¡£¼´12321ÊÇ»ØÎÄÊý£¬¸öλÓëÍòλÏàͬ£¬Ê®Î»ÓëǧλÏàͬ¡£
import java.util.*;
public class lianxi25 {
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
int a;
do{
System.out.print(¡°ÇëÊäÈëÒ»¸ö5λÕýÕûÊý£º¡±);
a = s.nextInt();
}while(a<10000||a>99999);
String ss =String.valueOf(a);
char[] ch = ss.toCharArray();
if(ch[0]==ch[4]&&ch[1]==ch[3]){
System.out.println(¡°ÕâÊÇÒ»¸ö»ØÎÄÊý¡±);}
else {System.out.println(¡°Õâ²»ÊÇÒ»¸ö»ØÎÄÊý¡±);}
}
}
//Õâ¸ö¸üºÃ£¬²»ÏÞλÊý
import java.util.*;
public class lianxi25a {
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
boolean is =true;
System.out.print(¡°ÇëÊäÈëÒ»¸öÕýÕûÊý£º¡±);
long a = s.nextLong();
String ss = Long.toString(a);
char[] ch = ss.toCharArray();
int j=ch.length;
for(int i=0; i if(ch[i]!=ch[j-i-1]){is=false;}
}
if(is==true){System.out.println(¡°ÕâÊÇÒ»¸ö»ØÎÄÊý¡±);}
else {System.out.println(¡°Õâ²»ÊÇÒ»¸ö»ØÎÄÊý¡±);}
}
}
¡¾³ÌÐò26¡¿
ÌâÄ¿£ºÇëÊäÈëÐÇÆÚ¼¸µÄµÚÒ»¸ö×ÖĸÀ´ÅжÏÒ»ÏÂÊÇÐÇÆÚ¼¸£¬Èç¹ûµÚÒ»¸ö×ÖĸһÑù£¬Ôò¼ÌÐø Åжϵڶþ¸ö×Öĸ¡£
import java.util.*;
public class lianxi26 {
public static void main(String[] args) {
getChar tw = new getChar();
System.out.println(¡°ÇëÊäÈëÐÇÆڵĵÚÒ»¸ö´óд×Öĸ£º¡±);
char ch = tw.getChar();
switch(ch) {
case ¡®M¡¯:
System.out.println(¡°Monday¡±);
break;
case ¡®W¡¯:
System.out.println(¡°Wednesday¡±);
break;
case ¡®F¡¯:
System.out.println(¡°Friday¡±);
break;
case ¡®T¡¯: {
System.out.println(¡°ÇëÊäÈëÐÇÆڵĵڶþ¸ö×Öĸ£º¡±);
char ch2 = tw.getChar();
if(ch2 == ¡®U¡¯) {System.out.println(¡°Tuesday¡±); }
else if(ch2 == ¡®H¡¯) {System.out.println(¡°Thursday¡±); }
else {System.out.println(¡°ÎÞ´Ëд·¨£¡¡±);
}
};
break;
case ¡®S¡¯: {
System.out.println(¡°ÇëÊäÈëÐÇÆڵĵڶþ¸ö×Öĸ£º¡±);
char ch2 = tw.getChar();
if(ch2 == ¡®U¡¯) {System.out.println(¡°Sunday¡±); }
else if(ch2 == ¡®A¡¯) {System.out.println(¡°Saturday¡±); }
else {System.out.println(¡°ÎÞ´Ëд·¨£¡¡±);
}
};
break;
default:System.out.println(¡°ÎÞ´Ëд·¨£¡¡±);
}
}
}


class getChar{
public char getChar() {
Scanner s = new Scanner(System.in);
String str = s.nextLine();
char ch = str.charAt(0);
if(ch<¡¯A¡¯ || ch>¡¯Z') {
System.out.println(¡°ÊäÈë´íÎó£¬ÇëÖØÐÂÊäÈ롱);
ch=getChar();
}
return ch;
}}
¡¾³ÌÐò27¡¿
ÌâÄ¿£ºÇó100Ö®ÄÚµÄËØÊý
//ʹÓóýsqrt(n)µÄ·½·¨Çó³öµÄËØÊý²»°üÀ¨2ºÍ3
public class lianxi27 {
public static void main(String[] args) {
boolean b =false;
System.out.print(2 + ¡± ¡°);
System.out.print(3 + ¡± ¡°);
for(int i=3; i<100; i+=2) {
for(int j=2; j<=Math.sqrt(i); j++) {
if(i % j == 0) {b = false;
break;
} else{b = true;}
}
if(b == true) {System.out.print(i + ¡± ¡°);}
}
}
}
//¸Ã³ÌÐòʹÓóý1λËØÊýµÃ2λ·½·¨£¬ÔËÐÐЧÂʸßͨÓÃÐԲ
public class lianxi27a {
public static void main(String[] args) {
int[] a = new int[]{2, 3, 5, 7};
for(int j=0; j<4; j++)System.out.print(a[j] + ¡± ¡°);
boolean b =false;
for(int i=11; i<100; i+=2) {
for(int j=0; j<4; j++) {
if(i % a[j] == 0) {b = false;
break;
} else{b = true;}
}
if(b == true) {System.out.print(i + ¡± ¡°);}
}
}
}
¡¾³ÌÐò28¡¿
ÌâÄ¿£º¶Ô10¸öÊý½øÐÐÅÅÐò
import java.util.*;
public class lianxi28 {
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
int[] a = new int[10];
System.out.println(¡°ÇëÊäÈë10¸öÕûÊý£º¡±);
for(int i=0; i<10; i++) {
a[i] = s.nextInt();
}
for(int i=0; i<10; i++) {
for(int j=i+1; j<10; j++) {
if(a[i] > a[j]) {
int t = a[i];
a[i] = a[j];
a[j] = t;
}
}
}
for(int i=0; i<10; i++) {
System.out.print(a[i] + ¡± ¡°);
}
}
}
¡¾³ÌÐò29¡¿
ÌâÄ¿£ºÇóÒ»¸ö3*3¾ØÕó¶Ô½ÇÏßÔªËØÖ®ºÍ
import java.util.*;
public class lianxi29 {
public static void main(String[] args) {
Sca

Ê×Ò³ ÉÏÒ»Ò³ 2 3 4 5 6 7 8 ÏÂÒ»Ò³ βҳ 5/9/9
¡¾´ó ÖРС¡¿¡¾´òÓ¡¡¿ ¡¾·±Ìå¡¿¡¾Í¶¸å¡¿¡¾Êղء¿ ¡¾ÍƼö¡¿¡¾¾Ù±¨¡¿¡¾ÆÀÂÛ¡¿ ¡¾¹Ø±Õ¡¿ ¡¾·µ»Ø¶¥²¿¡¿
ÉÏһƪ£ºexit£¨£©º¯ÊýºÍreturn Óï¾äÓÐʲô.. ÏÂһƪ£ºOracle DBA±ÊÊÔÌâ

×îÐÂÎÄÕÂ

ÈÈÃÅÎÄÕÂ

Hot ÎÄÕÂ

Python

C ÓïÑÔ

C++»ù´¡

´óÊý¾Ý»ù´¡

linux±à³Ì»ù´¡

C/C++ÃæÊÔÌâÄ¿