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 / indu

#include<stdio.h>
#include<conio.h>
main()
{
int n,s=0,i;
clrscr();
printf("Enter the number\n");
scanf("%d",&n);
for(i=2;i<n/2;i++)
{
if(n%i==0)
s++;
}
if(s>=1)
printf("%d is not prime",n);
else
printf("%d is prime",n);
getch();
}
ill execute it .it's cent percent correct.

Is This Answer Correct ?    40 Yes 22 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Do you know what is overriding?

1221


What should main() return in c and c++?

1036


Will a recursive function without an end condition every quit, in practice a) Compiler-Specific (Some can convert to an infinite loop) b) No c) Yes

1094


Can a program run without main in c++?

1226


what is C++ exceptional handling?

1190


Are vectors passed by reference c++?

1007


Difference between inline functions and macros?

1064


What are the sizes and ranges of the basic c++ data types?

1056


What's the "software peter principleā€?

1160


Explain the problem with overriding functions

1172


Which is the best c++ compiler?

1096


What do you mean by function and operator overloading in c++?

1062


Difference between pointer to constant and constant pointer to a constant. Give example.

1135


What is a c++ map?

1431


What is a unnitialised pointer?

1102