Problem :
Remaining 2
Adapted by Neilor Tonin, URI
Brazil
Timelimit: 1
Brazil
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.
| Sample Input | Sample Output |
| 13 | 2 15 28 41 ... |
Solution:
#include<stdio.h>int main(){ long long n , i; scanf("%lld",&n); for(i=1; i<=10000; i++){ if(i%n==2) printf("%lld\n",i); } return 0;}
No comments:
Post a Comment