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
Can circle be called an ellipse?
how to explain our contribution in the project?
If I is an integer variable, which is faster ++i or i++?
What are the advantages of using pointers in a program?
I was a c++ code and was asked to find out the bug in that. The bug was that he declared an object locally in a function and tried to return the pointer to that object. Since the object is local to the function, it no more exists after returning from the function. The pointer, therefore, is invalid outside.
If a function doesn’t return a value, how do you declare the function?
Which programming language is best to learn first?
When should we use container classes instead of arrays?
Is string an object in c++?
If a header file is included twice by mistake in the program, will it give any error?
What is the this pointer?
What is a local variable?
Evaulate: 22%5 a) 2 b) 4 c) 0
You have two pairs: new() and delete() and another pair : alloc() and free(). Explain differences between eg. New() and malloc()
What does getch() do according to the ANSI C++ standard a) Reads in a character b) Checks the keyboard buffer c) Nothing in particular (Its not defined there)