Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- typedef long long LL;
- void fun(int n){
- bool ok = true;
- for (int i = 2; i <= (int) pow(n, 0.5); i++)
- if (n % i == 0){
- ok = false;
- break;
- }
- if (ok) printf("素数");
- else printf("合数");
- }
- int main()
- {
- int n = 15;
- fun(n);
- n = 31;
- fun(n);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement