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 malloc in c++?

1068


What is the best c++ ide?

1237


What is a c++ map?

1516


What are the advantages of using friend classes?

1200


Is eclipse good for c++?

1104


Explain polymorphism?

1125


What is the importance of mutable keyword?

1076


Which bit wise operator is suitable for turning off a particular bit in a number?

1164


If you push the numbers (in order) 1, 3, and 5 onto a stack, which pops out first a) 1 b) 5 c) 3

1435


What are the benefits of oop in c++?

1315


Write a function to find the nth item from the end of a linked list in a single pass.

1023


Which recursive sorting technique always makes recursive calls to sort subarrays that are about half size of the original array?

1064


Can we use pointers in c++?

1117


What is the two main roles of operating system?

1126


Why Pointers are not used in C++?

1126