Write a C++ Program to Check a number is Prime or not

By | 25.12.2016

Check a number is Prime or not


Write a C++ Program to Check given number is Prime number or not. Here’s simple C++ Program to Check given number is Prime number or not in C++ Programming Language.


A prime number is a natural number greater than 1 that has no positive divisors other than 1 and itself. It means a prime number is only divisible by 1 and itself, and it start from 2. The smallest prime number is 2

Here is source code of the C++ Program to Check given number is Prime number or not. The C++ program is successfully compiled and run(on Codeblocks) on a Windows system. The program output is also shown in below.


SOURCE CODE : :



Output : :



Above is the source code for C++ Program to Check given number is Prime number or not which is successfully compiled and run on Windows System.The Output of the program is shown above .

If you found any error or any queries related to the above program or any questions or reviews , you wanna to ask from us ,you may Contact Us through our contact Page or you can also comment below in the comment section.We will try our best to reach up to you in short interval.


Thanks for reading the post….

2
Leave a Reply

avatar
1 Comment threads
1 Thread replies
0 Followers
 
Most reacted comment
Hottest comment thread
0 Comment authors
codezclub  Post authorahmedseid Recent comment authors
  Subscribe  
newest oldest most voted
Notify of
ahmedseid
Guest
ahmedseid

if i=10 and n=10 i,e n=i, is n(10)prime?

codezclub  Post author
Guest
codezclub Post author

but it’s not possible,Since we create a condition ::
if(n%i==0)

then break;