From 3fb16ed6a4cd7e5bcd54f62ba89733b959e90309 Mon Sep 17 00:00:00 2001 From: Aniruddho Mitra <68218897+aniruddho-mitra@users.noreply.github.com> Date: Wed, 5 Oct 2022 10:48:14 +0530 Subject: [PATCH] Create checkprime.cpp --- checkprime.cpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 checkprime.cpp diff --git a/checkprime.cpp b/checkprime.cpp new file mode 100644 index 0000000..80150e9 --- /dev/null +++ b/checkprime.cpp @@ -0,0 +1,21 @@ +#include +using namespace std; +int main() +{ + int n, i, m=0, flag=0; + cout << "Enter the Number to check Prime: "; + cin >> n; + m=n/2; + for(i = 2; i <= m; i++) + { + if(n % i == 0) + { + cout<<"Number is not Prime."<