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 / arafat buet

#include<stdio.h>
int main()
{
int i,n,r;
printf("enter any number:");
scanf("%d",&n);
if(n==1)
printf("not prime\n");
for(i=2;i<n;i++)
{
r=n%2;
if(r==0)
{
printf("\nnot prime\n");
break;
}
}
if(i==n)
printf("prime\n");
return 0;
}

Is This Answer Correct ?    24 Yes 19 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How to write a multi-statement macro?

989


How can I sort a linked list?

973


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

2268


what do u mean by Direct access files? then can u explain about Direct Access Files?

2031


What is I ++ in c programming?

1059


The number of bytes of storage occupied by short, int and long are a) 2, 2 and 4 b) 2, 4 and 4 c) 4, 4 and 4 d) none

1194


How can I call a function with an argument list built up at run time?

1173


Differentiate between ordinary variable and pointer in c.

1101


#define f(g,h) g##h main O int i=0 int var=100 ; print f ("%d"f(var,10));} wat would be the output??

1910


Why do some versions of toupper act strangely if given an upper-case letter?

1037


how do you programme Carrier Sense Multiple Access

1926


What does typeof return in c?

1019


Find duplicates in a file containing 6 digit number (like uid) in O (n) time.

3183


Why static is used in c?

1034


Explain logical errors? Compare with syntax errors.

1011