Algorithm


Problem Name: beecrowd | 1078
Problem Link: https://www.beecrowd.com.br/judge/en/problems/view/1078

Multiplication Table

Adapted by Neilor Tonin, URI Brazil

Timelimit: 1

Read an integer N (2 < N < 1000). Print the multiplication table of N.
1 x N = N      2 x N = 2N        ...       10 x N = 10N 

Input

The input is an integer N (1 < N < 1000).

Output

Print the multiplication table of N., like the following example.

Input Sample Output Sample

140

1 x 140 = 140
2 x 140 = 280
3 x 140 = 420
4 x 140 = 560
5 x 140 = 700
6 x 140 = 840
7 x 140 = 980
8 x 140 = 1120
9 x 140 = 1260
10 x 140 = 1400

 

Code Examples

#1 Code Example with C Programming

Code - C Programming


#include <stdio.h>

int main()
{
    int N, i;
    scanf("%d", &N);
    
    for (i = 1; i  < = 10; i++) {
        printf("%d x %d = %dn", i,N,i*N);
    }
}
Copy The Code & Try With Live Editor

Input

x
+
cmd
140

Output

x
+
cmd
1 x 140 = 140 2 x 140 = 280 3 x 140 = 420 4 x 140 = 560 5 x 140 = 700 6 x 140 = 840 7 x 140 = 980 8 x 140 = 1120 9 x 140 = 1260 10 x 140 = 1400

#2 Code Example with C++ Programming

Code - C++ Programming


#include <cstdio>

int main()
{
    int n;

    scanf("%i", &n);

    printf("1 x %i = %in", n, n);
    printf("2 x %i = %in", n, n * 2);
    printf("3 x %i = %in", n, n * 3);
    printf("4 x %i = %in", n, n * 4);
    printf("5 x %i = %in", n, n * 5);
    printf("6 x %i = %in", n, n * 6);
    printf("7 x %i = %in", n, n * 7);
    printf("8 x %i = %in", n, n * 8);
    printf("9 x %i = %in", n, n * 9);
    printf("10 x %i = %in", n, n * 10);

    return 0;
}
Copy The Code & Try With Live Editor

Input

x
+
cmd
140

Output

x
+
cmd
1 x 140 = 140 2 x 140 = 280 3 x 140 = 420 4 x 140 = 560 5 x 140 = 700 6 x 140 = 840 7 x 140 = 980 8 x 140 = 1120 9 x 140 = 1260 10 x 140 = 1400

#3 #3 Code Example with Another C++ Programming

Code - C++ Programming


#include <iostream>
using namespace std;
    
int main(int argc, const char * argv[])
{
    int n, i;

    cin >> n;

    for (i = 1; i  < = 10; i++)
    {
        cout << i << " x " << n << " = " << i*n << endl;
    }


    return 0;
}
Copy The Code & Try With Live Editor

Input

x
+
cmd
140

Output

x
+
cmd
1 x 140 = 140 2 x 140 = 280 3 x 140 = 420 4 x 140 = 560 5 x 140 = 700 6 x 140 = 840 7 x 140 = 980 8 x 140 = 1120 9 x 140 = 1260 10 x 140 = 1400

#4 Code Example with Java Programming

Code - Java Programming


import java.util.Scanner;

public class Main {

 public static void main(String[] args) {
    int N;
    Scanner input=new Scanner(System.in);
    N =input.nextInt();
    for (int i = 1; i  < = 10; i++) {
        System.out.print(i+" x "+N+" = "+(i*N)+"n");
    }

 }

}
Copy The Code & Try With Live Editor

Input

x
+
cmd
140

Output

x
+
cmd
1 x 140 = 140 2 x 140 = 280 3 x 140 = 420 4 x 140 = 560 5 x 140 = 700 6 x 140 = 840 7 x 140 = 980 8 x 140 = 1120 9 x 140 = 1260 10 x 140 = 1400

#5 Code Example with Python Programming

Code - Python Programming


n=int(input())
for i in range(1,11):
    print(f"{i} x {n} = {i*n}")
Copy The Code & Try With Live Editor

Input

x
+
cmd
140

Output

x
+
cmd
1 x 140 = 140 2 x 140 = 280 3 x 140 = 420 4 x 140 = 560 5 x 140 = 700 6 x 140 = 840 7 x 140 = 980 8 x 140 = 1120 9 x 140 = 1260 10 x 140 = 1400
Advertisements

Demonstration


Previous
#1077 Beecrowd Online Judge Solution 1077 Infix to Posfix - Solution in C, C++, Java, Python and C#
Next
#1079 Beecrowd Online Judge Solution 1079 Weighted Averages - Solution in C, C++, Java, Python and C#