September 13 Jobs

Source: Internet
Author: User
Tags greatest common divisor

First, homework (exercise) content:

1. Describe the operation principle of shell program (can be attached with necessary graphic instructions);

2, summarize all the knowledge points involved in shell programming (such as: variables, grammar, command status, etc., to take the picture of Yo);

3, summarize the course of all the circular statement, the use of conditional judgment and related examples; (if (jpg|png is not exist); echo "You say a XX")

4. Write a script: If a path does not exist, it is created as a directory; otherwise it is present and the content type is displayed; (Don't doubt it's that simple)

650) this.width=650; "title=" image "style=" border-left-0px; border-right-width:0px; Background-image:none; border-bottom-width:0px; padding-top:0px; padding-left:0px; padding-right:0px; border-top-width:0px "border=" 0 "alt=" image "src=" http://s3.51cto.com/wyfs02/M00/73/42/ Wkiol1x49lvgnxgtaac0ral4-5e601.jpg "width=" 447 "height=" 226 "/>

As a result, the parameter is Haoe

650) this.width=650; "title=" image "style=" border-left-0px; border-right-width:0px; Background-image:none; border-bottom-width:0px; padding-top:0px; padding-left:0px; padding-right:0px; border-top-width:0px "border=" 0 "alt=" image "src=" http://s3.51cto.com/wyfs02/M01/73/42/ Wkiol1x49lzwbefvaachbv-nw14510.jpg "width=" "height="/>

650) this.width=650; "title=" image "style=" border-left-0px; border-right-width:0px; Background-image:none; border-bottom-width:0px; padding-top:0px; padding-left:0px; padding-right:0px; border-top-width:0px "border=" 0 "alt=" image "src=" http://s3.51cto.com/wyfs02/M02/73/42/ Wkiol1x49l2zl8b8aabal48xad8836.jpg "width=" 454 "height="/>

Note: There must be a space [–e $filename] in the [] after the IF, and no spaces will go wrong.

5, write a script to complete the following functions; Judging the given two values, which is the big or small; the method of the given number: script parameter, command interaction; (still so simple using read)

650) this.width=650; "title=" image "style=" border-left-0px; border-right-width:0px; Background-image:none; border-bottom-width:0px; padding-top:0px; padding-left:0px; padding-right:0px; border-top-width:0px "border=" 0 "alt=" image "src=" http://s3.51cto.com/wyfs02/M00/73/42/ Wkiol1x49l6jwrvlaadglpvnoxc644.jpg "width=" 469 "height=" 221 "/>

Results

650) this.width=650; "title=" image "style=" border-left-0px; border-right-width:0px; Background-image:none; border-bottom-width:0px; padding-top:0px; padding-left:0px; padding-right:0px; border-top-width:0px "border=" 0 "alt=" image "src=" http://s3.51cto.com/wyfs02/M01/73/42/ Wkiol1x49l-jp5zcaadpcewfqfc878.jpg "width=" 477 "height=" 223 "/>

6, the sum of all the odd numbers within 100 (at least 3 methods. Yes, this is our assignment. ^_^)

6.1 For Loop

650) this.width=650; "title=" image "style=" border-left-0px; border-right-width:0px; Background-image:none; border-bottom-width:0px; padding-top:0px; padding-left:0px; padding-right:0px; border-top-width:0px "border=" 0 "alt=" image "src=" http://s3.51cto.com/wyfs02/M02/73/42/ Wkiol1x49mcagm1maacwn9taa3s274.jpg "width=" 471 "height=" 249 "/>

Results

650) this.width=650; "title=" image "style=" border-left-0px; border-right-width:0px; Background-image:none; border-bottom-width:0px; padding-top:0px; padding-left:0px; padding-right:0px; border-top-width:0px "border=" 0 "alt=" image "src=" http://s3.51cto.com/wyfs02/M02/73/45/ Wkiom1x48oqamhotaabltqkpgcw388.jpg "width=" 475 "height="/>

6.2 While Loop

650) this.width=650; "title=" image "style=" border-left-0px; border-right-width:0px; Background-image:none; border-bottom-width:0px; padding-top:0px; padding-left:0px; padding-right:0px; border-top-width:0px "border=" 0 "alt=" image "src=" http://s3.51cto.com/wyfs02/M00/73/45/ Wkiom1x48ouxzak6aacwqiimtza806.jpg "width=" 476 "height=" 325 "/>

Results

650) this.width=650; "title=" image "style=" border-left-0px; border-right-width:0px; Background-image:none; border-bottom-width:0px; padding-top:0px; padding-left:0px; padding-right:0px; border-top-width:0px "border=" 0 "alt=" image "src=" http://s3.51cto.com/wyfs02/M01/73/45/ Wkiom1x48oztzseqaabfbahkydo282.jpg "width=" 478 "height="/>

6.3 Until cycle

650) this.width=650; "title=" image "style=" border-left-0px; border-right-width:0px; Background-image:none; border-bottom-width:0px; padding-top:0px; padding-left:0px; padding-right:0px; border-top-width:0px "border=" 0 "alt=" image "src=" http://s3.51cto.com/wyfs02/M01/73/42/ Wkiol1x49mpawsdlaacdgaimn4q014.jpg "width=" 478 "height=" 286 "/>

Results

650) this.width=650; "title=" image "style=" border-left-0px; border-right-width:0px; Background-image:none; border-bottom-width:0px; padding-top:0px; padding-left:0px; padding-right:0px; border-top-width:0px "border=" 0 "alt=" image "src=" http://s3.51cto.com/wyfs02/M02/73/42/ Wkiol1x49mptt4zvaabtx8v03bm283.jpg "width=" 482 "height="/>

7, write a script to achieve the following functions:

650) this.width=650; "title=" image "style=" border-left-0px; border-right-width:0px; Background-image:none; border-bottom-width:0px; padding-top:0px; padding-left:0px; padding-right:0px; border-top-width:0px "border=" 0 "alt=" image "src=" http://s3.51cto.com/wyfs02/M00/73/42/ Wkiol1x49msbmmcoaaa6nulavyq646.jpg "width=" 496 "height=" "/>"

(1) Pass two text file path to script;

(2) Show the number of blank lines in two files and their blank lines;

(3) Show the total number of files in two files and their total number of rows;

650) this.width=650; "title=" image "style=" border-left-0px; border-right-width:0px; Background-image:none; border-bottom-width:0px; padding-top:0px; padding-left:0px; padding-right:0px; border-top-width:0px "border=" 0 "alt=" image "src=" http://s3.51cto.com/wyfs02/M01/73/42/ Wkiol1x49mxwbbsnaaewlmq9zom983.jpg "width=" 502 "height=" 276 "/>

I found that the sign behind the return was wrong and written &, but the result was right.

Note: The parameters of the bash function are not enclosed in parentheses and are written directly

Results

650) this.width=650; "title=" image "style=" border-left-0px; border-right-width:0px; Background-image:none; border-bottom-width:0px; padding-top:0px; padding-left:0px; padding-right:0px; border-top-width:0px "border=" 0 "alt=" image "src=" http://s3.51cto.com/wyfs02/M02/73/42/wKioL1X49MexoyumAAEKrQQ_A_ W691.jpg "width=" 506 "height=" "/>"

8. Write a script

(1) Prompt the user to enter a string;

(2) Judgment:

If the input is quit, exit the script;

Otherwise, the string content of its input is displayed;

650) this.width=650; "title=" image "style=" border-left-0px; border-right-width:0px; Background-image:none; border-bottom-width:0px; padding-top:0px; padding-left:0px; padding-right:0px; border-top-width:0px "border=" 0 "alt=" image "src=" http://s3.51cto.com/wyfs02/M00/73/42/ Wkiol1x49mejlmplaacig5htc64966.jpg "width=" 511 "height=" 245 "/>

The above can only be judged once, the following will be output

650) this.width=650; "title=" image "style=" border-left-0px; border-right-width:0px; Background-image:none; border-bottom-width:0px; padding-top:0px; padding-left:0px; padding-right:0px; border-top-width:0px "border=" 0 "alt=" image "src=" http://s3.51cto.com/wyfs02/M01/73/42/ Wkiol1x49mix3fnnaactkttnbzm071.jpg "width=" 506 "height=" 284 "/>

Results

650) this.width=650; "title=" image "style=" border-left-0px; border-right-width:0px; Background-image:none; border-bottom-width:0px; padding-top:0px; padding-left:0px; padding-right:0px; border-top-width:0px "border=" 0 "alt=" image "src=" http://s3.51cto.com/wyfs02/M02/73/42/wKioL1X49MjQJN_ Uaadvv1t7lda009.jpg "width=" 504 "height=" 248 "/>

9, write a script, print 2^n table; n equals the value entered by a user; (Sorry, I'm naughty)

650) this.width=650; "title=" image "style=" border-left-0px; border-right-width:0px; Background-image:none; border-bottom-width:0px; padding-top:0px; padding-left:0px; padding-right:0px; border-top-width:0px "border=" 0 "alt=" image "src=" http://s3.51cto.com/wyfs02/M00/73/42/ Wkiol1x49mmsczzmaab-dhbhmqq885.jpg "Width=" 510 "height=" 217 "/>

Results

650) this.width=650; "title=" image "style=" border-left-0px; border-right-width:0px; Background-image:none; border-bottom-width:0px; padding-top:0px; padding-left:0px; padding-right:0px; border-top-width:0px "border=" 0 "alt=" image "src=" http://s3.51cto.com/wyfs02/M01/73/42/ Wkiol1x49mnhehzraabssnngel0081.jpg "width=" 514 "height="/>

650) this.width=650; "title=" image "style=" border-left-0px; border-right-width:0px; Background-image:none; border-bottom-width:0px; padding-top:0px; padding-left:0px; padding-right:0px; border-top-width:0px "border=" 0 "alt=" image "src=" http://s3.51cto.com/wyfs02/M02/73/42/ Wkiol1x49mnwpvy3aabw0jonviw503.jpg "width=" 517 "height="/>

10, write a script, write a few functions: function 1, to achieve the sum of two numeric values, function 2, take a given two numeric value of greatest common divisor, function 3, take a given two numeric value of least common multiple; about the selection of functions, the size of two values will be provided through interactive input.

Sum

650) this.width=650; "title=" image "style=" border-top:0px; border-right:0px; Background-image:none; border-bottom:0px; padding-top:0px; padding-left:0px; border-left:0px; padding-right:0px "border=" 0 "alt=" image "src=" http://s3.51cto.com/wyfs02/M02/73/45/ Wkiom1x48psjdr5gaad10eefkdu951.jpg "" 549 "height=" 388 "/>

Size sort, big in front

650) this.width=650; "title=" image "style=" border-top:0px; border-right:0px; Background-image:none; border-bottom:0px; padding-top:0px; padding-left:0px; border-left:0px; padding-right:0px "border=" 0 "alt=" image "src=" http://s3.51cto.com/wyfs02/M00/73/45/ Wkiom1x48psxrosiaad2rhvdiy8771.jpg "557" height= "/>"

Greatest common divisor

650) this.width=650; "title=" image "style=" border-top:0px; border-right:0px; Background-image:none; border-bottom:0px; padding-top:0px; padding-left:0px; border-left:0px; padding-right:0px "border=" 0 "alt=" image "src=" http://s3.51cto.com/wyfs02/M02/73/45/ Wkiom1x48pxzn4txaacnh1t9itc261.jpg "" 577 "height=" 216 "/>

650) this.width=650; "title=" image "style=" border-top:0px; border-right:0px; Background-image:none; border-bottom:0px; padding-top:0px; padding-left:0px; border-left:0px; padding-right:0px "border=" 0 "alt=" image "src=" http://s3.51cto.com/wyfs02/M02/73/42/ Wkiol1x49mycxx4faacoaw1nqdw588.jpg "" 571 "height=" 179 "/>

Least common multiple

The formula is $fint1* $int 2/Greatest common divisor

This also reported wrong.

September 13 Jobs

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.