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 does a pointer variable always consist of?

1103


How can I open a file so that other programs can update it at the same time?

1187


What are different types of operators?

1045


What is c preprocessor mean?

1319


Where are c variables stored in memory?

1073


What is boolean in c?

1094


Synonymous with pointer array a) character array b) ragged array c) multiple array d) none

1071


main() { int i = 10; printf(" %d %d %d ", ++i, i++, ++i); }

1158


What is the method to save data in stack data structure type?

1089


What is pointer to pointer in c with example?

1078


Define and explain about ! Operator?

1002


Explain output of printf("Hello World"-'A'+'B'); ?

1500


What is the use of typedef in structure in c?

973


What is the use of linkage in c language?

1067


What are the types of data types and explain?

1091