Wednesday, December 2, 2015

Uri problem 1075 solve

Problem :

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.
Sample InputSample Output
132
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