Answer Posted / tuhin pal chowdhury
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
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;
getch();
}
| Is This Answer Correct ? | 1 Yes | 2 No |
Post New Answer View All Answers
How would you find out if a linked-list is a cycle or not?
How do you add an element to a set in c++?
How can you quickly find the number of elements stored in a dynamic array? Why is it difficult to store linked list in an array?
Explain virtual class?
Does c++ have arraylist?
Explain what are mutator methods in c++?
Should a constructor be public or private?
Describe the role of the c++ in the tradeoff of safety vs. Usability?
What is private, public and protected inheritance?
Define pre-condition and post-condition to a member function in c++?
What flag means?
Mention the ways in which parameterized can be invoked.
What is an operator in c++?
What is the use of class in c++?
Why should you learn c++?