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 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 diff --git a/C++/README.md b/C++/README.md index e32606d8..455f1979 100644 --- a/C++/README.md +++ b/C++/README.md @@ -4,6 +4,7 @@ | Program No.| Question | | ------- | ------ | + | [Program-01](https://github.com/swaaz/basicprograms/blob/814a1e60ae23d81158d8174666f23c9b7419e15e/C++/Program-01/Program.cpp) | Program to find the maximum and minimum element in an array. | | [Program-02](https://github.com/swaaz/basicprograms/blob/814a1e60ae23d81158d8174666f23c9b7419e15e/C++/Program-2/number_of_occurrence.cpp) | Program to find the number of occurrence of X element present in sorted array. | | [Program-03](https://github.com/swaaz/basicprograms/blob/814a1e60ae23d81158d8174666f23c9b7419e15e/C++/Program-3/program.cpp) | Program to Swap the Kth Elements of a series. |