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

Write a program to find factorial of a number using recursive function.

1134


How do you convert strings to numbers in C?

1237


How many types of errors are there in c language? Explain

998


What is I ++ in c programming?

1129


How can I read a binary data file properly?

1184


what is the significance of static storage class specifier?

2270


Is c is a low level language?

1153


Are bit fields portable?

1165


Is void a keyword in c?

993


Is c procedural or object oriented?

1034


i have a written test for microland please give me test pattern

2744


Is it cc or c in a letter?

1034


What are run-time errors?

1128


Why array is used in c?

1026


What is extern variable in c with example?

1010