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 program for prime numbers?

Answer Posted / kiran kumar maharana

#include<iostream.h>
#include<conio.h>
int prime(int);
void main()
{
int n;
cout<<"enter a no.";
cin>>n;
int x;
x=prime(n);
if(x==1)
cout<<"prime";

else
cout<<"not a prime no.";

}
int prime(int n)
{
int i,count=0;
if(n<2)
{
return 0;
}
else
{for(i=2;i<n;i++)

{
if(n%i==0)
{
count++;
}
}
if(count>=1)
{

return 0;

}
else
return 1;}

}

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain the use of #pragma exit?

1112


Explain what is the use of a semicolon (;) at the end of every program statement?

1184


What does c mean?

974


What is the purpose of sprintf() function?

1053


Is null always defined as 0(zero)?

1042


Why is c so important?

997


What is difference between union and structure in c?

1070


What is dynamic memory allocation?

1283


What is the difference between a function and a method in c?

1034


please help me..... please codes and flowchart plz turbo c lang po yan.....please asap response... 3. Make an astrology program. The user types in his or her birthday (month, day, and year as integer), and the program responds with the user’s zodiac sign, horoscope, and other information related to it. If the user’s birth year falls into a leap year, your program should display an appropriate message for it. NOTES: Conditional Statements: it should be with graphics

3275


What is structure packing in c?

1024


Why pointers are used?

1022


Why n++ execute faster than n+1 ?

2845


How do you determine the length of a string value that was stored in a variable?

1081


Explain what are the __date__ and __time__ preprocessor commands?

1073