aboutsummaryrefslogtreecommitdiffstats
path: root/misc
diff options
context:
space:
mode:
Diffstat (limited to '')
-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;