Shell script implementation 99 multiplication table

Source: Internet
Author: User

  1. #!/bin/bash
  2. #for嵌套for循环
  3. #9 *9 Multiplication Formula
  4. Echo "for 99 multiplication table"
  5. for ((I=1; i<=9;i++))
  6. Do
  7. For ((j=1;j<=9;j++))
  8. Do
  9. #当 $j less than or equal to $i, the multiplication table is printed on the screen
  10. [ $j-le $i] && echo-n "$i * $j =$[$i * $j]"
  11. Done
  12. Echo '
  13. Done
  14. #9 *9 Multiplication Formula
  15. # echo "Until 99 multiplication table"
  16. # a=1
  17. # b=1
  18. # until [$a-GT 9]
  19. # do
  20. # until [$b-GT 9]
  21. # do
  22. # when $J is less than or equal to $i, the multiplication table is printed on the screen
  23. # [$b-le $a] && echo-n "$a * $b =$[$a * $b]"
  24. # b=$[$b + 1]
  25. # Done
  26. # echo '
  27. # a=$[$a + 1]
  28. # done
  29. #9 *9 Multiplication Formula
  30. # echo "While 99 multiplication table"
  31. # I=1
  32. # j=1
  33. # while [$i-lt 10]
  34. # do
  35. # while [$j-lt]
  36. # do
  37. # when $J is less than or equal to $i, the multiplication table is printed on the screen
  38. # [$j-le $i] && echo-n "$i * $j =$[$i * $j]"
  39. # j=$[$j \+1]
  40. # Done
  41. # echo '
  42. # i=$[$i \+1]
  43. # done
  44. #9 *9 Multiplication Formula
  45. Echo "While with for 99 multiplication table"
  46. I=1
  47. While [ $i-lt]
  48. Do
  49. For ((j=1;j<=9;j++))
  50. Do
  51. #当 $j less than or equal to $i, the multiplication table is printed on the screen
  52. [ $j-le $i] && echo-n "$i * $j =$[$i * $j]"
  53. Done
  54. Echo '
  55. i=$[ $i +1]
  56. Done
  57. #9 *9 Multiplication Formula
  58. Echo "until and for 99 multiplication table"
  59. I=1
  60. Until [ $i-gt 9]
  61. Do
  62. For ((j=1;j<=9;j++))
  63. Do
  64. #当 $j less than or equal to $i, the multiplication table is printed on the screen
  65. [ $j-le $i] && echo-n "$i * $j =$[$i * $j]"
  66. Done
  67. Echo '
  68. i=$[ $i +1]
  69. Done
  70. #9 *9 Multiplication Formula
  71. # echo "Until with while 99 multiplication table"
  72. # I=1
  73. # j=1
  74. # until [$i-GT 9]
  75. # do
  76. # while [$j-lt]
  77. # do
  78. # when $J is less than or equal to $i, the multiplication table is printed on the screen
  79. # [$j-le $i] && echo-n "$i * $j =$[$i * $j]"
  80. # j=$[$j +1]
  81. # Done
  82. # echo '
  83. # i=$[$i +1]
  84. # done

Shell script implementation 99 multiplication table

Related Article

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.