aboutsummaryrefslogtreecommitdiffstats
path: root/misc
diff options
context:
space:
mode:
Diffstat (limited to 'misc')
-rw-r--r--misc/test.cpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/misc/test.cpp b/misc/test.cpp
new file mode 100644
index 0000000..493114a
--- /dev/null
+++ b/misc/test.cpp
@@ -0,0 +1,25 @@
+#include <iostream>
+#include <iomanip>
+#include <math.h>
+using namespace std;
+
+int main () {
+ unsigned long long x;
+ int a;
+ cout << "Enter a number:";
+ cin >> x;
+ unsigned long long i = (x-1);
+
+ for (i=x; i>1; --i/*--*/) {
+ if (x%i==0 && x!=i) {
+ cout << "Not prime!" << endl;
+ a=1700;
+ break;
+ return 3;
+ }
+ }
+
+ if (a!=1700)
+ cout << "Prime!" << endl;
+ return 0;
+} \ No newline at end of file