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,flag;
clrscr();
printf("\n Enter prime no\n");
scanf("%d",&n);
for(int i=2;i<=n/2;i++)
{
if(n%i==0)
{
flag=0;
break;
}
}
if(flag==0)
printf("\n%d is not prime",n);
else
printf("\n %d is prime",n);
getch();
}

Is This Answer Correct ?    21 Yes 17 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain what is the advantage of a random access file?

1124


Explain what is the difference between a string and an array?

1171


How does pointer work in c?

1126


Is swift based on c?

1108


Is there a way to compare two structure variables?

1126


What does dm mean sexually?

1318


Is it possible to pass an entire structure to functions?

998


Tell us two differences between new () and malloc ()?

1196


Do array subscripts always start with zero?

1304


What is function prototype in c with example?

1087


What is the behavioral difference when include header file in double quotes (“”) and angular braces (<>)?

1347


What is this infamous null pointer, anyway?

1061


If the size of int data type is two bytes, what is the range of signed int data type?

1026


shorting algorithmS

2255


What is mean by data types in c?

1032