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

Explain what is page thrashing?

1099


I just typed in this program, and it is acting strangely. Can you see anything wrong with it?

1010


Write a code on reverse string and its complexity.

1034


Why can't I perform arithmetic on a void* pointer?

1096


Write a program to compute the similarity between two strings - The program should get the two strings as input - Then it will output one single number which is the percentage of similarity between the two strings

2752


What is the difference between NULL and NUL?

1290


What does sizeof int return?

1081


What are directives in c?

974


What are two dimensional arrays alternatively called as?

1182


explain what are pointers?

1013


What is typeof in c?

1011


What is getch c?

1298


What is data structure in c and its types?

1071


Explain how do you determine the length of a string value that was stored in a variable?

1152


How can you tell whether two strings are the same?

1257