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

Does c++ have arraylist?

978


What is difference between n and endl in c++?

1051


Describe Trees using C++ with an example.

1103


What are the various oops concepts in c++?

986


What is the difference between object-oriented programming and procedural programming?

1168


How much do c++ programmers make?

1075


Write a program for Divide a number with 2 and Print the output ( NOTE: Check for divide by zero error).

1075


What do nonglobal variables default to a) auto b) register c) static

1113


Define upcasting.

995


Is c++ slower than c?

995


Name the operators that cannot be overloaded in C++?

1013


Can we overload operator in c++?

997


Explain the use of virtual destructor?

1035


Do vectors start at 0?

958


What is a string example?

1034