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

Differentiate between the manipulator and setf( ) function?

1097


What is c++ similar to?

1135


What does std :: flush do?

1076


What is c strings syntax?

1075


What is the benefit of c++?

1048


What is c++ 11 and c++ 14?

1003


What is the correct syntax for inheritance a) class aclass : public superclass b) class aclass inherit superclass c) class aclass <-superclass

1130


what are the events occur in intr activated on interrupt vector table

1667


Are vectors faster than arrays?

958


What do you mean by public protected and private in c++?

1000


Explain the differences between private, public and protected and give examples.

955


Where is atoi defined?

1063


Explain how we implement exception handling in c++?

1008


What doescout<<(0==0) print out a) 0 b) 1 c) Compiler error: Lvalue required

930


Can comments be longer than one line?

1020