URI / BEE CROWD 1075 - Remaining 2 Solution in C,C++,Python | URI - BEECROWD - BEE 1075 Solution in C,C++,Python

URI / BEE CROWD 1075 - Remaining 2 Solution in C,C++,Python | URI - BEECROWD - BEE 1075 Solution in C,C++,Python

                                                                                            beecrowd | 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 (< 10000)

Output

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

Input SampleOutput Sample

13

2
15
28
41
...

URI / BEE CROWD 1075 - Remaining 2 Solution in C,C++,Python | URI - BEECROWD - BEE 1075 Solution in C,C++,Python

                                     Demonstration:

Here we apply a range-based for loop which provides all the integers available in the input interval.
After this, checking the condition for this problem which divided by N will give the rest = 2
Finally, print the result. 
N.B: Don't copy paste the code as same. Just try to understand it and try yourself.

  URI / BEE 1075 Solution in C :   

  URI / BEECROWD Online Judge 1075 Solve  in C :                                          

#include<stdio.h>

int main()
{
    int i,n;
    scanf("%d",&n);
    for(i=1;i<=10000;i++){
        if(i%n==2){
            printf("%d\n",i);
        }
    }
}

 

1 Response to URI / BEE CROWD 1075 - Remaining 2 Solution in C,C++,Python | URI - BEECROWD - BEE 1075 Solution in C,C++,Python