aboutsummaryrefslogtreecommitdiffstats
path: root/misc/test.cpp
blob: 40e15c55bee26518822b5eb5638b2d8601c59a57 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include <iostream>
using namespace std;

int main () {
  unsigned long long x,i;
  bool a;
  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; }
    }
  
  if (!a)
  cout << "Prime!" << endl;
  return 0;
}