aboutsummaryrefslogtreecommitdiffstats
path: root/misc
diff options
context:
space:
mode:
authorRossTheRoss <msattr@gmail.com>2019-02-07 21:36:19 +0000
committerRossTheRoss <msattr@gmail.com>2019-02-07 21:36:19 +0000
commit96e61378343e7b84d33774a09be9fc94aa66a3be (patch)
tree114c571cbbc1cf84508719bfd373f846b0673e8d /misc
parentAHHHHHHH Why is this so hard (diff)
downloadhomework-96e61378343e7b84d33774a09be9fc94aa66a3be.tar
homework-96e61378343e7b84d33774a09be9fc94aa66a3be.tar.gz
homework-96e61378343e7b84d33774a09be9fc94aa66a3be.tar.bz2
homework-96e61378343e7b84d33774a09be9fc94aa66a3be.tar.lz
homework-96e61378343e7b84d33774a09be9fc94aa66a3be.tar.xz
homework-96e61378343e7b84d33774a09be9fc94aa66a3be.tar.zst
homework-96e61378343e7b84d33774a09be9fc94aa66a3be.zip
Bored in Lecture? Find prime numbers!
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