URI Online Judge Solution 1075 Remaining 2 using C Programming Language.
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 ... |
Solution using C :
#include <stdio.h>
int main() {
int num,i;
scanf("%d",&num);
for(i=1; i<=10000; i++)
{
if(i%num == 2)
printf("%d\n",i);
}
return 0;
}
Comments
Post a Comment