aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRossTheRoss <msattr@gmail.com>2019-02-12 20:39:40 +0000
committerRossTheRoss <msattr@gmail.com>2019-02-12 20:39:40 +0000
commitfca75858fff65231226326cd4201ecec203a591e (patch)
tree0dd74f66c28c7a73e079e45833eb61a8f6baa792
parentError code change? (diff)
downloadhomework-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.cpp18
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;