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
Is java made in c++?
Can we use clrscr in c++?
Is dev c++ free?
What is low level language in simple words?
A company pays its salespeople on a commission basis. The salespeople receive $200 per week plus 9 percent of their gross sales for that week. For example, a saleperson who sells $5000 worth of merchandise in a week receives $200 plus 9 percent of $5000, or a total of $650. You have been supplied with a list of items sold by each salesperson. The values of these items are as follows: Item Value A 239.99 B 129.75 C 99.95 D 350.89 Write a program that inputs one salesperson's items sold in a week (how many of item A? of item B? etc.) and calculates and displays that salesperson's earnings for that week.
On throwing an exception by the animal constructor in p = new animalq, can memory leak occur?
What is do..while loops structure?
Do you know what are pure virtual functions?
What is the use of setfill in c++?
In which situation the program terminates before reaching the breakpoint set by the user at the beginning of the mainq method?
Why do we need pointers?
By using c++ with an example describe linked list?
How do c++ struct differs from the c++ class?
Which sort does c++ use?
What is the oldest programming language?