Find the number within 100 that can be divisible by 7, display 7 per line, and then wrap the display

Source: Internet
Author: User

    1. The script is as follows


#!/bin/bash


#初始化一个中间变量m

M=1


For ((i=1;i<=100;i++))

Do

#设置中间变量temp1的值

Let "temp1=i%7"


If ["$temp 1"-ne 0]; Then

Continue

Fi


#输入结果

Echo-n "$i"


#设置中间变量temp2的值, this value is used for line wrapping

Let "temp2=m%7"


#每行显示7个数

If ["$temp 2"-eq 0]; Then

echo ""

Fi


Let "m++"

Done


2. Output results

7 14 21 28 35 42 49

56 63 70 77 84 91 98


This article is from the "Never Stop" blog, please be sure to keep this source http://wjcaiyf.blog.51cto.com/7105309/1681478

Find the number within 100 that can be divisible by 7, display 7 per line, and then wrap the display

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.