乘法表

出自ProgWiki
跳至導覽 跳至搜尋

乘法表,參照:『維基百科~Multiplication_table

C

#include <stdio.h>
 
int main()
{
    for (int i = 1; i < 10; i++)
    {
        for (int j = 1; j < 10; j++)
        {
            printf("%d * %d = %d \n", i, j, i * j);
        }
    }
    return 0;
}

Java

public class MultiplicationTable 
{
    public static void main(String[] args) 
    {
        for(int i = 1; i <= 10; i++)
        {
            for(int j = 1; j <= 10; j++)
            {
                System.out.printf("%d * %d = %d \n", i, j, i * j);
            }
        }
    }
}

Python

for i in range(1, 10, 1):
    for j in range(1, 10, 1):
        print(i, 'x', j, '=', i*j)