Answer Posted / prits
#include <iostream>
using namespace std;
void main()
{
int num;
int flag = 0;
cout<<"enter a number"<<endl;
cin>>num;
for(int i=2;i<num;i++)
{
if((num%i) == 0)
{
flag = 1;
break;
}
}
if (flag == 1)
cout<<"Not Prime"<<endl;
else
cout<<"Prime"<<endl;
}
Is This Answer Correct ? | 32 Yes | 15 No |
Post New Answer View All Answers
What is setf in c++?
How do you print a string on the printer?
Const char *p , char const *p What is the difference between the above two?
What do you mean by vtable and vptr in c++?
what is COPY CONSTRUCTOR and what is it used for?
Is c++ a pure oop language?
Differentiate between a copy constructor and an overloaded assignment operator.
What is the object serialization?
How do I tokenize a string in c++?
Define pre-condition and post-condition to a member function in c++?
Perform addition, multiplication, subtraction of 2-D array using Operator Overloading.
What is the difference between C and CPP?
Write a Program for dynamically intialize a 2 dimentional array. Eg:5x20, accept strings and check for vowels and display the no.finally free the space allocated .
what is data abstraction in C++?
What do you mean by function pointer?