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

What is the full form of stl in c++?

1196


Write a C++ Program to check whether a number is prime number or not?

1133


In which situation the program terminates before reaching the breakpoint set by the user at the beginning of the mainq method?

1066


Explain what data encapsulation is in c++?

1104


What is runtime polymorphism in c++?

1162


Difference between delete and free.

1081


What is the best c++ compiler?

1164


What is the difference between delegation and implemented-in-terms-of?

1009


Is c++ platform dependent?

1085


Which software is used for c++ programming?

1086


What is the difference between the functions rand(), random(), srand() and randomize()?

1292


What are the types of pointer?

1098


How will you call C functions from C ++ and vice-versa?

1147


Why do we use setw in c++?

1115


What is a Default constructor?

1602