求救!!!
查看原帖
求救!!!
1025321
midsummer_zyl楼主2023/7/14 21:56

哪里出错了?

我的代码:

#include <bits/stdc++.h>
using namespace std;
int zs(int x) {
	if(x <= 1)
		return 0;
	if(x == 2)
		return 1;
	for (int j = 2; j * j <= x; j++)
		if(x % j == 0)
			return 0;
	return 1;
}
int main() {
	int n;
	scanf("%d", &n);
	int m = n;
	if(zs(n) == 1) {
		cout << "Prime" << endl;
		return 0;
	}
	else if(n % 2 != 0 && n % 5 != 0 && n % 3 != 0) {
		cout << "Prime" << endl;
		return 0;
	}
	else {
		cout << "Not Prime" << endl;
		return 0;
	}
    return 0;
}
2023/7/14 21:56
加载中...