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 a program to find whether the given number is prime or
not?

Answer Posted / md.ershad ezaz

#include<stdio.h>
#include<conio.h>
void main()
{
int i,n,c;
clrscr();
printf("Enter a number\n");
scanf("%d",&n);
c=0;
for(i=1;i<=n;i++)
{
if(n%i==0)
c=c+1;
}
if(c==2)
printf("%d is prime",n);
else
printf("%d is not prime",n);
getch();
}

Is This Answer Correct ?    2 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How to check whether string is a palindrome, WITHOUT USING STRING FUNCTIONS?

16632


Why c is called a middle level language?

1068


Difference between Function to pointer and pointer to function

1033


any C program contains only one function, it must be a) void () b) main () c) message () d) abc ()

1094


What is strcmp in c?

1046


What are extern variables in c?

961


What are different storage class specifiers in c?

1058


What is the use of gets and puts?

992


Write a program to implement queue.

1080


i want to know the procedure of qualcomm for getting a job through offcampus

2425


cin.ignore(80, _ _);This statement a) ignores all input b) ignores the first 80 characters in the input c) ignores all input till end-of-line d) iteration

1065


What is preprocessor with example?

1013


Calculate the weighted average of a list of n numbers using the formula xavg = f1x1+f2x2+ ….+ fnxn where the f’s are fractional weighting factors, i.e., 0<=fi<1, and f1+f2+….+fn = 1

4202


What is the difference between specifying a constant variable like with constant keyword and #define it? i.e what is the difference between CONSTANT FLOAT A=1.25 and #define A 1.25

1952


What are void pointers in c?

974