You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

16 lines
344 B

#include <bits/stdc++.h>
using namespace std;
int main() {
int p, i;
long long sum = 9;
printf("请输入一个素数:\n");
scanf("%d", &p);
for (i = 1;; i++)
if (sum % p == 0)break;
else sum = sum * 10 + 9;
printf("素数%d能整除%d个9组成的数%ld\n", p, i, sum);
return 0;
}