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

Why is error handling required?

651


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

6468


What are keywords in the vbscript language?

616


How to make sure that items in a wintree are sorted al?

2446


How will you compare two strings in vbscript?

687






regular expression that will recognize a browser as long as its name property starts with mybrowser

1847


what is inner join? what is outer join? what is a constraint? tell me about rdbms? tell me about acid properties?

1519


i am having some basic knowledge in c and VB 6.0. i qtp i want to know how to write the codings. by recording it is generating lot of codings. for example i want to test the text box. senerio is text box should not accept alphabets if it accept alphabets we should return fail status if it get number we should return pass status. how to write coding in vb script please help me

1898


Write a function for Instr(). We need to write a function that works as same as Instr(). Code or Even pseudo code is good enough for me.?

2126


Why to use option explicit in vb script?

701


How will you get a subset of a array in vbscript?

669


What is vbscript language used for and which earlier language is it modeled upon?

626


Mention how you can call vbscript functions?

668


Hi Friends my Question is very simple,in Manual testing when we click on a hyper link it directs us to the relavent page or it re-directs us to the current page,so there we can easily write testcase but same thing if we do in automation script using QTP & need to generate report using Reporter.report event how we will do it?thanks in advance...

1735


In what way program "hello world" you can write in vbscript?

749