Answer Posted / adnan sheikh
#include<iostream.h>
#include<conio.h>
main()
{
int i,j,num;
cout<<"enter nay number";
cin>>num;
j=static_cast<int>(num/2);
for(int i=2;i<=j;i++)
{
if(!(num%i))
break;
}
if(i==(j+1))
cout<<"number is prime";
else
cout<<"number is not prime";
getch();
}
| Is This Answer Correct ? | 8 Yes | 19 No |
Post New Answer View All Answers
What are vectors used for in c++?
Is it possible for the objects to read and write themselves?
Is overriding possible in c++?
Can we make any program in c++ without using any header file and what is the shortest program in c++.
Arrange Doubly linked list in the ascending order of its integral value and replace integer 5 with 7?
How many characters are recognized by ANSI C++?
What is the full name of logo?
Which recursive sorting technique always makes recursive calls to sort subarrays that are about half size of the original array?
What is linked list in c++?
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.
How do you master coding?
Write a function that swaps the values of two integers, using int* as the argument type?
Is swift faster than c++?
Explain the concept of dynamic allocation of memory?
Differentiate between late binding and early binding. What are the advantages of early binding?