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
What are the disadvantages of vbscript?
What are class properties?
Which keyword is used to declare a variable in the vbscript language?
Explain about arrays in vb script?
HOw we can apply web service checkpoint in QTP 9.5? I tried it out with net connection also. But not getting success.
How are comments handled in the vbscript language?
Mention how to assign a date value to a variable?
Which operator is used for fetching the modulus of the 2 numbers in the vbscript language?
What are the 2 ways in which a variable can be declared in the vbscript language?
what is the standards used for writing the script in QTP
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 ?
Why is the use of exit do or exit for statements within loops discouraged?
Explain the string concatenation function in vbscript?
Mention what is byref and byval parameters in vbscript?
Explain about vb script?