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 / nitesh sanwal

#include<stdio.h>
#include<math.h>
void main()
{
int n,i,prime=1;
printf("input the numbers");
scanf("%d",&n);
for(i=2;i<=sqrt(n);i++)
if(n%i==0)
{
prime=0;
break;
}
if(prime)
printf("%d is a prime number",n);
else
printf("%d is a not a prime number",n);
}

Is This Answer Correct ?    6 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Why c is a procedural language?

1054


Hi how many types of software editions are there and their difference (like home editions, enterprise, standard etc) can u please help me

1948


Why clrscr is used after variable declaration?

1688


What is the most efficient way to count the number of bits which are set in an integer?

1053


Here is a good puzzle: how do you write a program which produces its own source code as output?

1099


How to write a code for reverse of string without using string functions?

2145


What is the time and space complexities of merge sort and when is it preferred over quick sort?

1077


Place the #include statement must be written in the program?

1038


Why does the call char scanf work?

1205


How can I sort more data than will fit in memory?

1110


What is the best way to store flag values in a program?

1074


What is the size of enum in bytes?

1089


general for is %wd,f-d; in this system "w" means a) 'w' represent total width of digits b) 'w' represent width which includes the digits before,after decimal place and the decimal point c) 'w' represent width which includes the digits before only d) 'w' represent width after decimal place only

1071


What is use of bit field?

1295


What is multidimensional arrays

1125