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

Does improper inheritance have a potential to wreck a project?

1089


How can we check whether the contents of two structure variables are same or not?

1022


how to connect with oracle 9i with server in socket program in c/c++

2286


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

1086


What are containers in c++?

940


Explain the difference between struct and class in terms of access modifier.

1134


What is the history of c++?

999


How does code-bloating occur in c++?

1139


Do class method definitions?

987


What are formatting flags in ios class?

1195


Explain what is class definition in c++ ?

1050


Does c++ support exception handling?

1009


Explain how to initialize a const data member.

1073


Describe the setting up of my member functions to avoid overriding by the derived class?

1073


What is the main purpose of c++?

1015