answersLogoWhite

0


Best Answer

#include <iostream.h>

main()

{

int a;

cout<<"enter a number : ";

cin>>a;

cout<<endl;

if (a%2-1)

cout<<"it is a Prime number";

else

cout<<"it is not a prime number"

return 0;

}

------------------------------------------

output: enter a number : 30

it is a not a prime number

User Avatar

Wiki User

14y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: C plus plus code that determine prime number?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

Which mobile company code is plus plus 372?

Its code of estonia


What is the Visual C plus plus 2008 Express Serial Code?

The Express edition of C++ does not require a serial code. It is free.


What colour code in c plus plus?

0-black.2-green


Source code of DSR and AODV in C plus plus?

code source de dsr sous omnet++4.1 en .cc


What is a source code file in c plus plus?

A source code file is a plain-text file containing C++ instructions. The instructions must be compiled and linked to create a native machine code executable.

Related questions

What are prime number and composite numbers?

a prime number is a number that you can plus by one


What prime number plus what prime number will give you 54?

47 + 7


What is prime plus prime?

A prime plus another prime is at the very least going to be an even number since all primes (with the exception of 2) are odd.


Does x squared plus x plus 41 always equal a prime number?

No. it's not a prime number when x = 40, 41, 81,82 ...


Is number 5x3x17 plus 17 a prime number?

No. (5x3x17) + 17 =255 + 17 =272 (This is not prime.)


Is 2187 plus 36295 a prime number?

No. The number 38,482 is composite.


What is the smallest number for n for which n2 plus n plus 17 is not a prime number?

n = 5.


Is 9x3 plus 12x2 a prime number?

yes


Testing c plus plus code prime number?

Use the following function to determine if a whole number is prime, including negative values: bool isprime(int p) { if(p&lt;0) p*=(-1); // convert to positive integer if( p&lt;2 ( p&gt;2 &amp;&amp; p&amp;1==0 )) return( false ); int max = (int)sqrt((double) p)+1; for( int i=3; i&lt;=max; i+=2 ) if( p%i==0 ) return( false ); return( true ); }


What is the sum of the smallest odd prime number and the largest prime number less than 100?

It is: 3 plus 97 = 100


What is P plus P plus N in prime numbers?

It would always be a natural number.


What prime number squared plus 3 gives an odd number?

22 + 3 = 7 Since 2 is the only even prime number, this is the only number for which this holds true.