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
How will you get the largest subscript of an array in vbscript?
Give me sm ideas to write Vbscripts abt protocol testing abilash700@gmail.com.
How to open browser in vb script?
I am working on QTP, got struck in one place.. In my application depending upon configuration WebEdit count is increasing/ decreasing.. how to get these webedits..
if u ve resrevation for train and u get a number supose 1234xxxokie.after sucessul entering all required fields. now u put that number in search and want to chk wether these ar same or not if both ar same then its okie otherwise test fail.what would be the vb script code for it to compare these two values of different page.
How to assign a date value to a variable?
how to write a vb script in QTP for yahoo registration form, i want to check the performance also like performance test, stress, load test like that.
Is vbscript language a case-sensitive language and what does it mean?
What are the uses of vb script?
Which data type/types are supported by vbscript language and what are their specialties?
What are the special sub-types in vbscript?
Explain the tristate constants in vbscript?
What is vbscript procedures?
What is the use of the instr function?
Which in-built function is used to format the number in the vbscript language?