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 / dinesh kumar.s

#include<stdio.h>
#include<conio.h>
void main()
{
int i,j,k,a;
clrscr();
printf("program created by dinesh mca anna university\n");
printf("enter the number\n");
scanf("%d",&a);

j=a;

if( a%2==0 || a%3==0 )
{
for(i=2;i<=a;i++)
if(a%i==0)
if (i==j)
{
printf("prime number");
break;
}

else
{
printf("not");
break;
}
}
else
{
printf("prime number");

}

getch();
}

Is This Answer Correct ?    1 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are pointers really good for, anyway?

1075


What is #define?

1128


Do character constants represent numerical values?

1358


What are the features of c languages?

1111


Once I have used freopen, how can I get the original stdout (or stdin) back?

1081


What is the difference between exit() and _exit() function in c?

1084


Define C in your own Language.

1090


I have a varargs function which accepts a float parameter?

1062


Is Exception handling possible in c language?

2055


What is a lookup table in c?

1129


What is a macro, and explain how do you use it?

1091


What is volatile variable in c?

1104


If you know then define #pragma?

1119


What is #line?

1070


What is the mean of function?

1147