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...

how to find the given number is prime or not?

Answer Posted / rahul tiwari

main()
{
int n,ctr=2,flag=0;
printf("enter the number to be checked\n");
scanf("%d",&n);
for(ctr=2;ctr<=n/2;ctr++)
{
if(n%ctr==0)
{
flag=1;
break;
}
}
if(flag==1)
printf("the given number is prime\n");
else
printf("the given number is not prime\n");
flag=9
getch();
}

Is This Answer Correct ?    8 Yes 7 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain how can I read and write comma-delimited text?

1114


pierrot's divisor program using c or c++ code

2169


What are header files in c programming?

1075


Is this program statement valid? INT = 10.50;

1083


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

1075


What is the use of the function in c?

971


What does node * mean?

1143


What is the benefit of using #define to declare a constant?

1044


Can we access array using pointer in c language?

1041


How many levels of pointers can you have?

1135


Can we use any name in place of argv and argc as command line arguments?

1012


how to find binary of number?

4337


Difference between exit() and _exit() function?

1077


Write the control statements in C language

1130


Explain pointer. What are function pointers in C?

1016