Skip to content

Instantly share code, notes, and snippets.

@abdalimran
Created February 12, 2016 18:53
Show Gist options
  • Save abdalimran/b49cccf0b17238a63615 to your computer and use it in GitHub Desktop.
Save abdalimran/b49cccf0b17238a63615 to your computer and use it in GitHub Desktop.
/* Bismillah hir rahmanir raheem. Thanks to Allah for everything.
Coder: Abdullah Al Imran
Email: abdalimran@gmail.com */
#include<bits/stdc++.h>
using namespace std;
bool isPrime (int n)
{
if(n<2)
return false;
for(long long i=2; i*i<=n; i++)
{
if (n%i==0)
return false;
}
return true;
}
int main()
{
ios_base::sync_with_stdio(false);
if(isPrime(5)==true)
cout<<"It is a prime number!"<<endl;
else
cout<<"It is not a prime number!"<<endl;
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment