Algorithm


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

Remaining 2

Adapted by Neilor Tonin, URI Brazil

Timelimit: 1

Read an integer N. Print all numbers between 1 and 10000, which divided by N will give the rest = 2.

Input

The input is an integer N (N < 10000)

Output

Print all numbers between 1 and 10000, which divided by n will give the rest = 2, one per line.

Input Sample Output Sample

13

2
15
28
41
...

 

Code Examples

#1 Code Example with C Programming

Code - C Programming


#include <stdio.h>

int main()
{
    int n, i;

    scanf("%i", &n);

    for (i = 1; i  < = 10000; ++i)
    {
        if(i % n == 2){
            printf("%in", i);
        }
    }

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

Input

x
+
cmd
13

Output

x
+
cmd
2 15 28 41 ...

#2 Code Example with C++ Programming

Code - C++ Programming


#include <cstdio>
int main()
{
    int n;

    scanf("%i", &n);

    for (int i = 1; i  < = 10000; ++i)
    {
        if(i % n == 2){
            printf("%in", i);
        }
    }

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

Input

x
+
cmd
13

Output

x
+
cmd
2 15 28 41 ...

#3 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 = 0; ((N*i) + 2)  <  10000; i++) {
            System.out.print((N*i) + 2+"n");
        }
    }
}
Copy The Code & Try With Live Editor

Input

x
+
cmd
13

Output

x
+
cmd
2 15 28 41 ...

#4 Code Example with Python Programming

Code - Python Programming


n=int(input())
for i in range(1,10000):
    if(i%n==2):
        print(i)
Copy The Code & Try With Live Editor

Input

x
+
cmd
13

Output

x
+
cmd
2 15 28 41 ...
Advertisements

Demonstration


Previous
#1074 Beecrowd Online Judge Solution 1074 Even or Odd - Solution in C, C++, Java, Python and C#
Next
#1077 Beecrowd Online Judge Solution 1077 Infix to Posfix - Solution in C, C++, Java, Python and C#