Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- using namespace std;
- bool CEL(int x) { // простое или нет
- int i;
- for (i = 2; i < sqrt(x); i++) {
- if (x % i == 0) {
- return (false);
- }
- }
- }
- int main() {
- setlocale(LC_ALL, "rus");
- try {
- int x;
- cout << "Введите число: ";
- cin >> x;
- if (!cin) {
- throw "Введите целое число";
- }
- }
- catch (const char* errorString) {
- cerr << endl << errorString << endl << endl;
- system("pause");
- return -1;
- }
- cout.setf(ios::boolalpha);
- cout << endl << "Число простое:" << CEL << endl << endl;
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement