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 / anjana rao .ch

\*Write a program wither given number is prime or not */
\*I think it is different to others (BY ANJAN)*/
#include<stdio.h>
main()
{
int n,a=3;
printf("Enter Number");
scanf("%d",&n);
if(n==2)
{
printf("Given Number is PRIME");
exit (0);
}
if(n==3)
{
printf("Given Number is PRIME");
exit (1);
}
if(n%2==0)
{
printf("Given Number is NOT PRIME");
exit (2);
}
while(a<=n/2)
{
if(n%a==0)
{
printf("Given Number is NOT PRIME");
exit (3);
}
a=a+2;
}
printf("Given Numbr is PRIME");
}

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

explain how do you use macro?

1207


Can the sizeof operator be used to tell the size of an array passed to a function?

1176


Write the test cases for checking a variable having value in range -10.0 to +10.0?

2368


write a c program to find the largest and 2nd largest numbers from the given n numbers without using arrays

2288


Describe explain how arrays can be passed to a user defined function

1164


What are the advantages and disadvantages of pointers?

1121


What is pre-emptive data structure and explain it with example?

3788


What does a pointer variable always consist of?

1157


What is the use of #include in c?

1127


Why is structure important for a child?

1148


Explain what is meant by 'bit masking'?

1265


What is array of pointers to string?

1157


Explain spaghetti programming?

1320


a character or group of characters that defines a register,or a part of storage a) memory b) byte c) address d) linear list

1049


Can you subtract pointers from each other? Why would you?

1005