JAVA±à³ÌÌâÈ«¼¯£¨100Ìâ¼°´ð°¸£©

} }

¡¾³ÌÐò18¡¿

ÌâÄ¿£ºÁ½¸öƹÅÒÇò¶Ó½øÐбÈÈü£¬¸÷³öÈýÈË¡£¼×¶ÓΪa,b,cÈýÈË£¬ÒÒ¶ÓΪx,y,zÈýÈË¡£ÒѳéÇ©¾ö¶¨±ÈÈüÃûµ¥¡£ÓÐÈËÏò¶ÓÔ±´òÌý±ÈÈüµÄÃûµ¥¡£a˵Ëû²»ºÍx±È£¬c˵Ëû²»ºÍx,z±È£¬Çë±à³ÌÐòÕÒ³öÈý¶ÓÈüÊÖµÄÃûµ¥¡£ 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 < m.length; i++) { for (int j = 0; j < n.length; 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

System.out.println(m[i] + \ } } } }

¡¾³ÌÐò19¡¿

ÌâÄ¿£º´òÓ¡³öÈçÏÂͼ°¸£¨ÁâÐΣ© * *** ***** ******* ***** *** *

public class lianxi19 {

public static void main(String[] args) {

int H = 7, W = 7;//¸ßºÍ¿í±ØÐëÊÇÏàµÈµÄÆæÊý for(int i=0; i<(H+1) / 2; i++) { for(int j=0; j

for(int k=1; k<(i+1)*2; k++) { System.out.print('*'); }

System.out.println(); }

for(int i=1; i<=H/2; i++) { for(int j=1; j<=i; j++) { System.out.print(\ }

for(int k=1; k<=W-2*i; k++) { System.out.print('*'); }

System.out.println(); } } }

¡¾³ÌÐò20¡¿

ÌâÄ¿£ºÓÐÒ»·ÖÊýÐòÁУº2/1£¬3/2£¬5/3£¬8/5£¬13/8£¬21/13...Çó³öÕâ¸öÊýÁеÄǰ20ÏîÖ®ºÍ¡£ public class lianxi20 {

public static void main(String[] args) { int x = 2, y = 1, t; double sum = 0;

for(int i=1; i<=20; i++) { sum = sum + (double)x / y; t = y; y = x; x = y + t; }

System.out.println(\ǰ20ÏîÏà¼ÓÖ®ºÍÊÇ£º \} }

¡¾³ÌÐò21¡¿

ÌâÄ¿£ºÇó1+2!+3!+...+20!µÄºÍ public class lianxi21 {

public static void main(String[] args) { long sum = 0; long fac = 1;

for(int i=1; i<=20; i++) { fac = fac * i; sum += fac; }

System.out.println(sum); } }

¡¾³ÌÐò22¡¿

ÌâÄ¿£ºÀûÓõݹ鷽·¨Çó5!¡£ public class lianxi22 {

public static void main(String[] args) { int n = 5;

rec fr = new rec();

System.out.println(n+\} }

class rec{

public long rec(int n) { long value = 0 ; if(n ==1 ) { value = 1; } else {

value = n * rec(n-1); }

return value; } }

¡¾³ÌÐò23¡¿

ÌâÄ¿£ºÓÐ5¸öÈË×øÔÚÒ»Æð£¬ÎʵÚÎå¸öÈ˶àÉÙËꣿËû˵±ÈµÚ4¸öÈË´ó2Ëê¡£ÎʵÚ4¸öÈËËêÊý£¬Ëû˵±ÈµÚ3¸öÈË´ó2Ëê¡£ÎʵÚÈý¸öÈË£¬ÓÖ˵±ÈµÚ2ÈË´óÁ½Ëê¡£ÎʵÚ2¸öÈË£¬Ëµ±ÈµÚÒ»¸öÈË´óÁ½Ëê¡£×îºóÎʵÚÒ»¸öÈË£¬Ëû˵ÊÇ10Ëê¡£ÇëÎʵÚÎå¸öÈ˶à´ó£¿ public class lianxi23 {

public static void main(String[] args) { int age = 10;

for(int i=2; i<=5; i++) { age =age+2; }

System.out.println(age); } }

¡¾³ÌÐò24¡¿ ÌâÄ¿£º¸øÒ»¸ö²»¶àÓÚ5λµÄÕýÕûÊý£¬ÒªÇó£ºÒ»¡¢ÇóËüÊǼ¸Î»Êý£¬¶þ¡¢ÄæÐò´òÓ¡³ö¸÷λÊý×Ö¡£ //ʹÓÃÁ˳¤ÕûÐÍ×î¶àÊäÈë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 + \ÊÇÒ»¸ö\λÊý¡£\ System.out.print(\°´ÄæÐòÊä³öÊÇ£º\ for(int i=j-1; i>=0; i--) { 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(\Õâ²»ÊÇÒ»¸ö»ØÎÄÊý\

ÁªÏµ¿Í·þ£º779662525#qq.com(#Ìæ»»Îª@)