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 / umesh prajapati

/* find the number is prime or not prime. umesh prajapati*/
#include<stdio.h>
#include<conio.h>
void main()
{
int n,c,r;
clrscr();
printf("ENTER THE VALUE");
scanf("%d",&n);
if(n==2)
printf("THE NUMBER IS CO-PRIME");
else
{
c=2;
while(c<n)
{
r=n%c;
if(r==0)
{
printf("GIVEN NUMBER IS NOT PRIME");
break;
}
c++;
}
if(r>0)
printf("GIVEN NUMBER IS PRIME");

}
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 pointer to pointer in c language?

1141


Are enumerations really portable?

1025


1234554321 1234 4321 123 321 12 21 1 1 12 21 123 321 1234 4321 1234554321

3714


I was asked to write a program in c which when executed displays how many no.of clients are connected to the server.

2367


What are 'near' and 'far' pointers?

1039


Is a house a shell structure?

1160


Difference between Shallow copy and Deep copy?

2019


What is the difference between far and near in c?

1066


Why is c so popular?

1163


What is sizeof array?

1054


What is modeling?

1047


What are header files and explain what are its uses in c programming?

1129


Explain what is the difference between functions getch() and getche()?

1049


Is this program statement valid? INT = 10.50;

1145


What is the difference between array and pointer in c?

1159