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 / umesh prajapati

/* find the number is prime or not prime. umesh prajapati*/
#include<stdio.h>
#include<conio.h>
void main()
{
int n,c,r;
clrscr();
printf("ENTER THE VALUE");
scanf("%d",&n);
if(n==2)
printf("THE NUMBER IS CO-PRIME");
else
{
c=2;
while(c<n)
{
r=n%c;
if(r==0)
{
printf("GIVEN NUMBER IS NOT PRIME");
break;
}
c++;
}
if(r>0)
printf("GIVEN NUMBER IS PRIME");

}
getch();
}

Is This Answer Correct ?    2 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain what are multibyte characters?

1111


explain what is a newline escape sequence?

1040


What is meant by keywords in c?

1036


a value that does not change during program execution a) variabe b) argument c) parameter d) none

1181


What is the correct declaration of main?

1154


What is a 'null pointer assignment' error?

1162


What is the difference between constant pointer and constant variable?

1165


what is the significance of static storage class specifier?

2185


Where are some collections of useful code fragments and examples?

1107


Explain the difference between malloc() and calloc() function?

988


What is the purpose of realloc()?

1094


How can you return multiple values from a function?

1051


What are register variables? What are the advantage of using register variables?

1128


What is clrscr in c?

1074


Why void main is used in c?

999