From fca75858fff65231226326cd4201ecec203a591e Mon Sep 17 00:00:00 2001 From: RossTheRoss Date: Tue, 12 Feb 2019 20:39:40 +0000 Subject: Parenthesis are hard --- misc/test.cpp | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) (limited to 'misc') 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 -#include -#include 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; -- cgit v1.2.3