aboutsummaryrefslogtreecommitdiffstats
path: root/misc/test.cpp
blob: 109925d2c98675bab320fb5ed5f9c7a4a5f0f0dd (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#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 << x << " is not prime!" << endl;
      cout << "Divisible by " << i << "." << endl << endl;
      a=1;
      break;
      }
    }
  
  if (!a){
  cout << x << " is a prime number!" << endl << endl;
  return 0;
  }
}