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

check whether a no is prime or not.

Answer Posted / rama

#include<stdio.h>
main()
{
int n,i,r;
clrscr();
printf("Enter the positive integer value");
scanf("%d",&n)
i=2;
step1:
if(i<=sqrt(n))
{
r=n%i;
if(r==0)
{
printf("%d is not a prime",n);
goto end;
}
}
else
{
i++;
goto step1;
}
printf("%d is prime number",n);
end:
printf(" ");
}

Is This Answer Correct ?    3 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is general form of pure virtual function? Explain?

984


Why is c++ so fast?

1016


Is sorted c++?

1084


Can there be at least some solution to determine the number of arguments passed to a variable argument list function?

991


What is srand c++?

1095


Explain terminate() function?

1037


What is a character in c++?

1027


Is c++ vector a linked list?

987


What is c++ try block?

1027


Do class declarations end with a semicolon? Do class method definitions?

1138


What are the new features that iso/ansi c++ has added to original c++ specifications?

1120


What is size_type?

1026


What kind of problems can be solved by a namespace?

1078


What is the use of namespace std in C++?

1058


What are the general quetions are in DEna bank manager IT/System interviews?

2003