Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <math.h>
- using namespace std;
- int main()
- {
- int n, x;
- cin >> n;
- x = int(sqrt(n));
- bool ans = true;
- for (int i = 2; i <= x; i++)
- {
- if (n % i == 0)
- {
- ans = false;
- }
- }
- if (ans == true)
- {
- cout << "prime" << endl;
- }
- else
- {
- cout << "composite" << endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement