The example in this paper describes how Python outputs the 9*9 multiplication table. Share to everyone for your reference. The implementation method is as follows:
#!/usr/bin/env python# 9 * 9for i in range (1, ten): print for J in range (1, i+1): print "%d*%d=%d"% (i, J, I*j ),
Add an easier way:
The code is as follows:
Print (' \ n '. Join (["%d*%d=%2s"% (y,x,x*y) for Y in range (1,x+1)]))
The 9-9 multiplication table is generally a triangle, with each number and the for (I = 1; I
The Code is as follows:
I, j, n = 9 "* |" "1" (I = 2; I
Effect
Publicclasschengfabiao{publicstaticvoidmain (String []args] {for (inti=1;iThis article is from the "Programmer's Learning Day" blog, so be sure to keep this source http://laiyicong.blog.51cto.com/10811813/1712222Java 99 multiplication Table
Nonsense not much to say, directly on the code!!The code is as follows: for (var i =1; i) { for (var j =1;j) { document.write ( I+ "*" +j + "=" + (i*j) + ' nbsp; ' ); } document.write (' ); }Resolution: The outer loop is 1 to 9,The inner loop is the printing of each layer,For example: When printing to the first layer: JThe effect is as follows:JavaScript-based print multiplication
This article mainly introduces PHP double-layer loop implementation 99 multiplication table, interested in the friend's reference, I hope to help you.
Examples are as follows:
"Run Results"
If there is only one sentence inside the curly brace, you can remove the curly brace, #include Number one represents the number of rows that can prove:99 multiplication Table Double cycle
1
One
The interfaces are:
The rule is: Check the trend of the 9-9 multiplication table, determine the for loop of the outermost layer, and check the column changes: from 1 to 9, or 9 to 1.
The shell script calls the jar package to print the multiplication table, shelljar
# Declaration script
#! /Bin/bash
# Print "------ cfb ---------"Echo "------ cfb ---------"
# Java environment variablesJAVA_HOME =/usr/java/jdk1.8.0 _ 11CLASSPATH = $ JAVA_HOME/bin
# Specify the location where the jar package needs to be executed. You can set it by yourself.
JARPATH =/home/haha/Desktop
# Standard form
#声明脚本#!/bin/bash#打印 "------CFB---------"echo "------CFB---------"#java环境变量Java_home=/usr/java/jdk1.8.0_11Classpath= $JAVA _home/bin#指定需要执行jar包的位置, you can set your ownJarpath=/home/haha/desktop#环境变量的标准格式Classpath= $CLASSPATH: $JARPATH/cfb.jar#export用来设置或者新增环境变量, and is limited to this logon operation, do not write, can not find the main classExport Classpath= $CLASSPATH#打印环境变量Echo $CLASSPATH#执行jingdian. The main method in the Cfbdemo classjava-xms50m-xmx250m Jingdian. Cfbdemo#退出ExitFinal print e
Output resultsSummarize the points of knowledge1. For loopFor v_1 in [list]DoDoneList if it is "1 2 3", then the V_1 value is an array 1 2 3If you want to assign only one value to v_1 at a time, you need to write separately, i.e. "1" "2" "3"2. Arithmetic operations in Bashk=$ ((i * j))There must be no spaces around the equals sign, no spaces for assignment.In addition, the arithmetic operation needs to be enclosed in $ (()), which means that the operation is performed first and the result is cal
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.