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 the disadvantages of vbscript?

1307


What are class properties?

1229


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

1005


Explain about arrays in vb script?

1124


HOw we can apply web service checkpoint in QTP 9.5? I tried it out with net connection also. But not getting success.

2557


How are comments handled in the vbscript language?

1054


Mention how to assign a date value to a variable?

1143


Which operator is used for fetching the modulus of the 2 numbers in the vbscript language?

1074


What are the 2 ways in which a variable can be declared in the vbscript language?

1122


what is the standards used for writing the script in QTP

2385


Set srchobj=Description.Create() srchobj("type").value="text" srchobj("name").value="q" srchobj("html tag").value="input" browser("micclass:=google").Page("micclass:=google").webedit (srchobj).Set "qtp" what's wrong in my code pls tell me ? the above code working fine and i got my result pass,now i am trying to run the program it shows general run time error why?pls help me i am in learning stage ?

1964


Why is the use of exit do or exit for statements within loops discouraged?

1096


Explain the string concatenation function in vbscript?

1101


Mention what is byref and byval parameters in vbscript?

1052


Explain about vb script?

1279