## Algorithm

Problem Name: 30 days of code - Day 5: Loops

In this HackerRank in 30 Days of Code - Day 5: Loops problem solution,

Objective
In this challenge, we will use loops to do some math. Check out the Tutorial tab to learn more.

Given an integer, n, print its first 10 multiples. Each multiple n * i (where 1 <= i <= 10) should be printed on a new line in the form: `n x i = result`.

Example

n = 3

The printout should look like this:

```3 x 1 = 3
3 x 2 = 6
3 x 3 = 9
3 x 4 = 12
3 x 5 = 15
3 x 6 = 18
3 x 7 = 21
3 x 8 = 24
3 x 9 = 27
3 x 10 = 30
```

Input Format

A single integer, n.

Constraints

2 <= n <= 20

Output Format

Print 10 lines of output; each line i (where 1 <= i <= 10) contains the result of n * i the form:
`n x i = result`.

Sample Input

``````2
``````

Sample Output

``````2 x 1 = 2
2 x 2 = 4
2 x 3 = 6
2 x 4 = 8
2 x 5 = 10
2 x 6 = 12
2 x 7 = 14
2 x 8 = 16
2 x 9 = 18
2 x 10 = 20
``````

## 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  < = 0; i++)
{
printf("%d x %d = %d\n",n,i,n*i);
}
return 0;
}
``````
Copy The Code &

### #2 Code Example with C++ Programming

```Code - C++ Programming```

``````
#include <iostream>

using namespace std;

int main() {
int N;
cin >> N;

for (int i = 1; i  <  11; i++) {
printf("%i x %i = %i\n", N, i, N * i);
}

return 0;
}
``````
Copy The Code &

### #3 Code Example with C# Programming

```Code - C# Programming```

``````
using System;

class Solution
{
static void Main(String[] args)
{

for (int i = 1; i  <  11; i++)
{
Console.WriteLine(\$"{N} x {i} = {N * i}");
}
}
}
``````
Copy The Code &

### #4 Code Example with Golang Programming

```Code - Golang Programming```

``````
package main

import "fmt"

func main() {
var n int
fmt.Scan(&n)
for i := 1; i  < = 10; i++ {
fmt.Printf("%d x %d = %d\n", n, i, i*n)
}
}
``````
Copy The Code &

### #5 Code Example with Java Programming

```Code - Java Programming```

``````
import java.util.Scanner;

public class Solution {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int N = in.nextInt();
in.close();

for (int i = 1; i  <  11; i++) {
System.out.println(N + " x " + i + " = " + N * i);
}
}
}
``````
Copy The Code &

### #6 Code Example with Javascript Programming

```Code - Javascript Programming```

``````start coding
process.stdin.resume();
process.stdin.setEncoding('ascii');

var input_stdin = "";
var input_stdin_array = "";
var input_currentline = 0;

process.stdin.on('data', function (data) {
input_stdin += data;
});

process.stdin.on('end', function () {
input_stdin_array = input_stdin.split("\n");
main();
});

return input_stdin_array[input_currentline++];
}

/////////////// ignore above this line ////////////////////

function main() {

for (var x = 1; x  <  11; x++)
{
var result = N*x;
console.log(N.toString() + " x " + x + " = " + result.toString());
}

}
``````
Copy The Code &

### #7 Code Example with Python Programming

```Code - Python Programming```

``````
N = int(input())

for i in range(1, 11):
print(str(N) + " x " + str(i) + " = " + str(N * i))
``````
Copy The Code &