Answer Posted / waleed
#include<iostream.h>
#include<conio.h>
int prime(int);
void main()
{
clrscr();
int num,x;
cout<<"Enter the no.=";
cin>>num;
x=prime(num);
if(x==1)
{
cout<<"Number is prime";
}
else
{
cout<<"Number is not prime";
}
getch();
}
int prime(int x)
{
int k;
for(int i=2;i<x;i++)
{
if (x%i==0)
{
k=2;
}
}
if (k==2)
return 0;
else
return 1;
}
| Is This Answer Correct ? | 2 Yes | 0 No |
Post New Answer View All Answers
What are compilers in c++?
How can you tell what shell you are running on unix system?
How can you quickly find the number of elements stored in a static array? Why is it difficult to store linked list in an array?
How would you call C functions from C++ and vice versa?
Explain how overloading takes place in c++?
What are libraries in c++?
What is algorithm in c++ programming?
Which is not an ANSII C++ function a) sin() b) tmpnam() c) kbhit()
How do you differentiate between overloading the prefix and postfix increments?
What is an object in c++?
Is dev c++ free?
Write about an iterator class?
What is the difference between while and do while loop?
What is function prototyping?
Can I learn c++ without knowing c?