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

What is graph in c?

1007


Who is the main contributor in designing the c language after dennis ritchie?

952


What is the meaning of typedef struct in c?

1000


Write a program to know whether the input number is an armstrong number.

1072


Write a program to print numbers from 1 to 100 without using loop in c?

1026


how to construct a simulator keeping the logical boolean gates in c

2195


What is a memory leak? How to avoid it?

1255


How can I write a function that takes a format string and a variable number of arguments?

1002


Is null a keyword in c?

1135


What is the difference between declaring a variable and defining a variable?

1183


What is #error and use of it?

1195


int i=10; printf("%d %d %d", i, i=20, i);

1548


Can we declare variables anywhere in c?

947


What is the package for freshers(Non IIT) in amazon(hyderabad). And what is the same for those who are a contract employee.

4240


Is c compiled or interpreted?

1128