diff options
author | RossTheRoss <msattr@gmail.com> | 2019-02-07 21:36:19 +0000 |
---|---|---|
committer | RossTheRoss <msattr@gmail.com> | 2019-02-07 21:36:19 +0000 |
commit | 96e61378343e7b84d33774a09be9fc94aa66a3be (patch) | |
tree | 114c571cbbc1cf84508719bfd373f846b0673e8d /misc | |
parent | AHHHHHHH Why is this so hard (diff) | |
download | homework-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.cpp | 25 |
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 |