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

How a new element can be added or pushed in a stack?

1024


When do we use copy constructors?

1088


What is object file? How can you access object file?

1215


What is enum c++?

1251


Is c++ proprietary?

1071


Which is most difficult programming language?

1114


Mention the ways in which parameterized can be invoked.

934


What is the difference between delegation and implemented-in-terms-of?

1015


What is the c++ code?

1187


Can you write a function similar to printf()?

1140


Why is the function main() special?

1106


What do you mean by global variables?

1083


Mention the ways in which parameterized can be invoked. Give an example of each.

1068


Is c++ a float?

1075


Out of fgets() and gets() which function is safe to use?

1141