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 / karthik

#include<stdio.h>
#include<conio.h>
void main()
{
int n,c=0,i;
clrscr();
printf("enter any number");
scanf("%d",&n);
for(i=1;i<=n;i++)
{
if(n%i==0)
c++;
}
(c==2)? printf("%d is a prime number",n):
printf("%d is not a prime number",n);
getch();
}

Is This Answer Correct ?    2 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the use of structure padding in c?

1024


Why is c called a structured programming language?

1233


Can a pointer point to null?

1039


Why are algorithms important in c program?

1085


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

1914


How can I run c program?

1136


What are the advantages and disadvantages of pointers?

1032


When should the volatile modifier be used?

1123


What is structure in c definition?

998


Do you have any idea how to compare array with pointer in c?

1008


Can you please explain the difference between exit() and _exit() function?

1001


What is spaghetti programming?

1089


Hai sir, I had planned to write the NIC scientific engineer exam , plz post the sample question......

2148


int i=3; this declaration tells the C compiler to a) reserve space in memory to hold the integer value b) associate the name i with this memory location c) store the value 3 at this location d) all the above

1239


Explain the difference between ++u and u++?

1082