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

Which loop is used in case of arrays in the vbscript language?

526


What are class properties?

657


after medical test,when will be the police verification

1720


Explain the adodb.stream class?

549


what is the use of QCUtil? explain with one example?

6328






Write a vbscript procedure that converts feet to inches. Hint: there are 12 inches in a foot?

582


If we take 2 strings as “good” and “bad” then what will ‘+’ and ‘&’ operators return?

538


What is the purpose of the err object in the vbscript language?

630


Explain the constants in vbscript?

568


How to declare an array in vbscript?

671


How many types of operators are available in the vbscript language?

541


write any ttest cases using check points and parameterization

1823


How will you release the memory acquired by an array variable in vbscript?

750


Which operator can be used to do an xor operation in vbscript?

684


How will you get the smallest subscript of an array in vbscript?

814