diff options
author | RossTheRoss <msattr@gmail.com> | 2019-02-12 20:39:40 +0000 |
---|---|---|
committer | RossTheRoss <msattr@gmail.com> | 2019-02-12 20:39:40 +0000 |
commit | fca75858fff65231226326cd4201ecec203a591e (patch) | |
tree | 0dd74f66c28c7a73e079e45833eb61a8f6baa792 | |
parent | Error code change? (diff) | |
download | homework-fca75858fff65231226326cd4201ecec203a591e.tar homework-fca75858fff65231226326cd4201ecec203a591e.tar.gz homework-fca75858fff65231226326cd4201ecec203a591e.tar.bz2 homework-fca75858fff65231226326cd4201ecec203a591e.tar.lz homework-fca75858fff65231226326cd4201ecec203a591e.tar.xz homework-fca75858fff65231226326cd4201ecec203a591e.tar.zst homework-fca75858fff65231226326cd4201ecec203a591e.zip |
Parenthesis are hard
-rw-r--r-- | misc/test.cpp | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/misc/test.cpp b/misc/test.cpp index 564b6f2..fd9c227 100644 --- a/misc/test.cpp +++ b/misc/test.cpp @@ -1,22 +1,18 @@ #include <iostream> -#include <iomanip> -#include <math.h> using namespace std; int main () { - unsigned long long x; - cout << "Enter a number:"; - cin >> x; - unsigned long long i = (x-1); + unsigned long long x,i; int a; - for (i=x; i>1; --i) { - if (x%i==0 && x!=i) { + cout << "Enter a number:"; cin >> x; + + for (i=x; i>1; --i) + + {if (x%i==0 && x!=i) { cout << "Not prime!" << endl; a=1; break; - return i; - } - } + return i;}} if (a!=1) cout << "Prime!" << endl; |