From 1709cdc4abe5371109c7dc6e031afc3592125a21 Mon Sep 17 00:00:00 2001 From: Akash Sharma Date: Wed, 6 Oct 2021 15:23:30 +0530 Subject: [PATCH 1/3] Program 26 - Prime No. Program in C++ --- C++/Program 26/PrimeNo.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 C++/Program 26/PrimeNo.cpp diff --git a/C++/Program 26/PrimeNo.cpp b/C++/Program 26/PrimeNo.cpp new file mode 100644 index 00000000..a8e9b66b --- /dev/null +++ b/C++/Program 26/PrimeNo.cpp @@ -0,0 +1,20 @@ +#include +using namespace std; +int main(){ + int n,k=0; + cout<<"Check the no is prime or not"<>n; + for(int i=1;i<=n;i++){ + if(n%i==0){ + k++; + } + } + if(k==2){ + cout<<"No. is Prime"; + } + else{ + cout<<"No. is not prime"; + } + + return 0; +} \ No newline at end of file From 7725733d549f94f7e847e3121cfb4e842aafef98 Mon Sep 17 00:00:00 2001 From: Akash Sharma Date: Wed, 6 Oct 2021 15:27:48 +0530 Subject: [PATCH 2/3] Program 26 - Added a readme file with I/O --- C++/Program 26/ReadMe.md | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 C++/Program 26/ReadMe.md diff --git a/C++/Program 26/ReadMe.md b/C++/Program 26/ReadMe.md new file mode 100644 index 00000000..f95cb40d --- /dev/null +++ b/C++/Program 26/ReadMe.md @@ -0,0 +1,7 @@ +Program to check whether the no. is prime or not + +Input: 6 +Output: No. is not prime + +Input: 5 +Output: No. is prime \ No newline at end of file From 9abf4f6b68020716a16b643f03439a23ae0724c2 Mon Sep 17 00:00:00 2001 From: Akash Sharma Date: Wed, 6 Oct 2021 15:29:46 +0530 Subject: [PATCH 3/3] Updated Readme in C++ Folder --- C++/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/C++/README.md b/C++/README.md index de6ed221..2164b018 100644 --- a/C++/README.md +++ b/C++/README.md @@ -15,3 +15,4 @@ | Program-19| To check whether a number is in palindrome or not | Program-24 | Program to convert Hexa-Decimal number to Decimal number | Program-25 | Program to Implement Queue Data Structure Using Linked Lists +| Program-26 | Program to Check whether the no. is prime or not \ No newline at end of file