Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

write the prime no program in c++?

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


Please Help Members By Posting Answers For Below Questions

What are vectors used for in c++?

1142


Is it possible for the objects to read and write themselves?

1167


Is overriding possible in c++?

1065


Can we make any program in c++ without using any header file and what is the shortest program in c++.

1173


Arrange Doubly linked list in the ascending order of its integral value and replace integer 5 with 7?

4171


How many characters are recognized by ANSI C++?

1465


What is the full name of logo?

1167


Which recursive sorting technique always makes recursive calls to sort subarrays that are about half size of the original array?

1064


What is linked list in c++?

1176


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.

2606


How do you master coding?

1092


Write a function that swaps the values of two integers, using int* as the argument type?

1080


Is swift faster than c++?

1070


Explain the concept of dynamic allocation of memory?

1152


Differentiate between late binding and early binding. What are the advantages of early binding?

1080