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
Explain the virtual inheritance in c++.
What do you mean by late binding?
What is an object in c++?
What are c++ tokens?
Is swift better than c++?
Will rust take over c++?
Define macro.
Is c++ a float?
What's the order in which the objects in an array are destructed?
What is the object serialization?
what is the use of void main() in C++ language?
Explain what you mean by a pointer.
What is functions syntax in c++?
Explain how we implement exception handling in c++?
What is private public protected in c++?