Description
一个正整数与3的和是5的倍数,与3的差是6的倍数,编写一个程序求符合条件的前n个数。
Input
正整数n(1 =< n <= 1000)
Output
符合条件的数,每个一行。
Sample Input
5
Sample Output
27
57
87
117
147
Description
一个正整数与3的和是5的倍数,与3的差是6的倍数,编写一个程序求符合条件的前n个数。
Input
正整数n(1 =< n <= 1000)
Output
符合条件的数,每个一行。
Sample Input
5
Sample Output
27
57
87
117
147
#include "stdio.h"
int main(){
int i = 1, n;
scanf("%d",&n);
while(n > 0){
if((i + 3) % 5 == 0 && (i - 3) % 6 == 0){
printf("%d\n",i);
n --;
}
i ++;
}
}