Answer Posted / swapnil
/*To check whethere Entered no. is PRIME or NOT*/
#include<iostream.h>
#include<conio.h>
main()
{
int num,i;
clrscr();
cout<<"Enter the any no.="<<"\n";
cin>>num;
for(i=2;i<=num;i++)
{
if(num%i==0)
{
break;
}
}
if(i==num)
{
cout<<"The number entered is a
PRIME no.";
}
else
{
cout<<"The number entered is NOT a
PRIME no.";
}
getch();
}
| Is This Answer Correct ? | 74 Yes | 41 No |
Post New Answer View All Answers
Explain this pointer?
What you know about structures in C++?
Describe the syntax of single inheritance in C++?
Why main function is special in c++?
Name the implicit member functions of a class.
Why is main an int?
What is a stack c++?
Write a recursive program to calculate factorial in c++.
What is the difference between c++ and turbo c++?
What is the full form nasa?
What is the default access level?
What is algorithm in c++ programming?
find the two largest values among the 6 numbers using control structures : do-while,for,if else,nestedif- else ,while. one or two of them.
What is the return value of the insertion operator?
which of the following is not an secondary constant a) array b) real c) union