answersLogoWhite

0

#include<iostream.h> #include<conio.h>

int main()

{

int i,n;

clrscr();

cout<<"PROGRAM TO CHECK IF THE NUMBER IS PRIME OR NOT:"<<endl;

cout<<"Enter a number:";

cin>>n;

for(int i=2;i<n;i++)

{

if(n%i==0)

cout<<"\nTHE NUMBER IS COMPOSITE"<<endl;

else

cout<<"\nTHE NUMBER IS PRIME"<<endl;

}

return 0;

}

User Avatar

Wiki User

14y ago

What else can I help you with?

Related Questions

Is 588 prime composite or neither?

It's even. All even numbers (except for 2) are composite.


How do you write a program in objective c numbers 1-100 prime numbers?

fdsgfhgdfhgdf


How do you write a C plus plus program that will display the first 10 positive prime numbers?

By learning how to program on C+.


Write a C program to find the sum of all prime numbers?

Since there is an infinite set of prime numbers the answer would be infinity.


What number has only 6 prime numbers?

Any number of the form n = a*b*c*d*e*f where a, b, c, d, e and f are different prime numbers. n has 26 = 64 factors in total, of which 1 is the number 1 (neither prime nor composite), 6 are prime, and the remaining 57 are composite.


When you multiply a prime and a composite number do you always get a composite number?

Product of a prime number and a composite number results in a composite number.Now consider the product of a composite number(a) and a prime number(b) is equal to c.i.e. c = a x bIt is clear that c is divisible by both a and b.Also c is divisible by itself and 1, this means that c has more than two factors.A number having more than two factors is composite, therefore product of a prime number and a composite number results in a composite number.


How do you write a c program to get a range from user and give a list of prime numbers?

To get all tutorials of "c programming" Reference:cprogramming-bd.com/c_page2.aspx# prime number


Is 61 96 3 75 142 113 a prime or composite number?

3, 61 and 113 are prime; the rest composite.


How many even numbers are prime between 1 and 100?

1, which is 2 b/c all of the other even numbers are divisible by 2, therefore making it composite.


Is C a prime or composite or square number?

The answer depends on the value of C, which is unknown.


Is 10ac a prime or composite?

Assuming that a and c are both integers, 10ac must be composite because it is equal to 2*5*a*c.


Is two the first prime number?

yes b/c 1 is neither prime or composite