99 exponentiation Table/array sort/Reverse output string

Source: Internet
Author: User
Tags array sort

Hello everyone:

Today, when visiting Baidu, a Sesame asked a question, feeling he is a beginner! Embellish his code into the next few programs! Let's share it!

A total of five methods:

<span style= "FONT-SIZE:18PX;" >//Format 4 * 3 * 2 * 1 = 24</span>
<span style= "FONT-SIZE:18PX;" >//</span><span style= "FONT-SIZE:18PX; Font-family:arial, Helvetica, Sans-serif; > number from zero to nine added to 13 </span>
<span style= "FONT-SIZE:18PX;" >//</span><span style= "FONT-SIZE:18PX; Font-family:arial, Helvetica, Sans-serif; > 99-Exponent Table </span>
<span style= "FONT-SIZE:18PX;" >//</span><span style= "FONT-SIZE:18PX; Font-family:arial, Helvetica, Sans-serif; > Array Sorting </span>
<span style= "FONT-SIZE:18PX;" >//</span><span style= "FONT-SIZE:18PX; Font-family:arial, Helvetica, Sans-serif; > Reverse Output string </span>
I have integrated these methods, console input and output printing!

<span style= "font-size:18px;" >import Java.util.scanner;public class Test {public static void main (string[] args) {Scanner inrecurrence =new Scanner ( system.in); System.out.println ("Please enter the number of starts you need to calculate the score, enter end:"); Long n = Recurrence (Inrecurrence.nextint ()); SYSTEM.OUT.PRINTLN (n); getforstring ();p rintstring (); Scanner Inshuzu =new Scanner (system.in); int[] Shuzu=new int[3];     System.out.println ("Please enter a 3 number comparison"); for (int i=0;i<shuzu.length;i++) {shuzu[i]=inshuzu.nextint ();} Compute (Shuzu); Scanner Zifuchuan =new Scanner (system.in); System.out.println ("Enter string for reverse output"); GetString (Zifuchuan.nextline ());} Format 4 * 3 * 2 * 1 = 24private static long recurrence (int n) {if (n = = 1) {System.out.print ("1 ="); return 1;} Else{system.out.print (n+ "*"); return n * Recurrence (n-1);}} </span> 
<span style= "font-size:18px;" >//</span><span style= "FONT-SIZE:18PX; Font-family:arial, Helvetica, Sans-serif; > The number </span><span style= "font-size:18px" from zero to nine added to 13; >private static void Getforstring () {SYSTEM.OUT.PRINTLN (the number added from zero to nine is 13: "), for (int a=0; a<=9; a++) {for (int b=0; b <=9;  B + +) {if (a+b = =) {System.out.println ("a=" +a+ "" + "b=" +b+ ""); }}}}</span> 
<span style= "font-size:18px;" >//</span><span style= "FONT-SIZE:18PX; Font-family:arial, Helvetica, Sans-serif; > 99 </span><span style= "FONT-SIZE:18PX;" >private static void Printstring () {System.out.println ("99" Table: "); for (int i = 1; I <= 9;  i + +) {for (int j = 1; J <= I; j + +) {System.out.print (j+ "*" +i+ "=" +i*j+ "); }system.out.println ();} System.out.println ("The 99" table is over!) ");} </span><span style= "FONT-SIZE:18PX; Font-family:arial, Helvetica, Sans-serif; > Array sort </span><span style= "font-size:18px;" >private static int compute (int[] in) {System.out.println ("array sort:"); int temp = 0;for (int i = 0; i < in.length; i + +) { for (int j = 0; J < In.length; J + +) {if (In[i] > In[j]) {temp = In[i];in[i] = in[j];in[j] = temp;}}} for (int k = 0; k < in.length; k + +) {System.out.print (In[k] + ",");} System.out.println ("Sort end! "); return Math.Abs (In[0]-in[in.length-1]);} </span> 
<span style= "FONT-SIZE:18PX;" >//</span><span style= "FONT-SIZE:18PX; Font-family:arial, Helvetica, Sans-serif; > Reverse Output string </span><span style= "FONT-SIZE:18PX;" >private static void GetString (String str) {System.out.println ("Reverse Output string! "); if (str! = null &&!str.isempty ()) {for (int i = Str.length ()-1; I >= 0; i--) {System.out.print (Str.charat (i))}}} </span>
The result is:

<span style= "FONT-SIZE:18PX;" > Enter the number of starts you need to calculate your score, enter the end: 44 * 3 * 2 * 1 = 24 Add nine from zero to 13: a=4 b=9 a=5 b=8 a=6 b=7 a=7 b=6 a=8 b=5 a=9 b=4 99 table: 1*1=1 1*  2=2  2*2=4  1*3=3  2*3=6  3*3=9  1*4=4  2*4=8  3*4=12  4*4=16  1*5=5  2*5=10  3*5=15  4*5=20  5*5=25  1*6=6  2*6=12  3*6=18  4*6=24  5*6=30  6*6=36  1*7=7  2*7=14  3*7=21  4*7=28  5*7=35  6*7=42  7*7=49  1*8=8  2*8=16  3*8=24  4*8=32  5*8=40  6*8=48  7*8=56  8*8=64  1*9=9  2*9=18  3*9=27  4*9=36  5*9=45  6*9=54  7*9=63  8*9=72  9*9=81  99 the table is over! Please enter a 3 number comparison 3 6 8 array Sort: 8,6,3, sort end! sdee333 Reverse Output String! 333eeds</span>


99 exponentiation Table/array sort/Reverse output string

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.