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

Hi, Anybody could you Please tell me How to write the
script for Checking whether given number is Prime Number or
not..Thanks in Advance

Answer Posted / anant

boolean isPrime(int num){
if(num==0 || num==1){
System.out.println("Number should be greater than 1");
System.Exit(0);
}
if(num%2==0 || num%3==0 || num%5==0 || num%7==0)
System.out.println("Number is not prime");
else
System.out.println("Number is prime");
}

Is This Answer Correct ?    2 Yes 14 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are class properties?

1099


Mention the rules for using option explicit statement?

925


Explain some uses of vb script?

919


how to increasing the numbers in a given text box please write a vb script

2152


Can we create Crystal Report object in QTP?If yes then what it is and what are its various properties?

3408


What are the advantages of vbscript?

1029


why variable name should not exceed 255 characters?

2168


Which keyword is used to declare a variable in the vbscript language?

898


How do you declare a variable in vbscript?

1021


Which conditional statement is the most convenient one to use in the case of multiple conditions in the vbscript language?

909


How to replace junk code recorded by QTP with a mall function.

2012


give me any information abou vb script books learn quckly

2100


Which operator is used to perform the comparison among 2 operands in the vbscript language?

900


What are the different types of loops available in the vbscript language?

932


What are the differences between sub procedures and function procedures?

931