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
What is virtual base class?
How is data hiding achieved in c++?
What is the use of seekg in c++?
What is the latest version on c++?
Can member data be public?
What is exception handling? Does c++ support exception handling?
What is an overflow error?
How do you initialize a string in c++?
Write a short code using c++ to print out all odd number from 1 to 100 using a for loop
What are single and multiple inheritances in c++?
How do we implement inheritance in c++?
What is the difference between delegation and implemented-in-terms-of?
What are separators in c++?
What are pointers, when declared, intialized to a) NULL b) Newly allocated memory c) Nothing. Its random
How to declare a function pointer?