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 to open excel in vb script?
What is the use of the ‘open’ method to work with the database in the vbscript language and what connection string is passed in the same and what is its usage?
Mention the environments where vbscript could be run?
What is the purpose of drive object of scripting.filesystemobject class in vbscript?
How to Import data from a file (file is on the desktop) to the data table
How to Convert Hex color code to color name in VB Script?
Explain the filter expression?
Explain different types of segment?
about vb scripting programs this type of all question& answers
why variable name should not exceed 255 characters?
How to write functions and sub in vb script?
Explain about .wsf files?
How do i automate a website www.flyashx.com without having any test cases witin a week time.
1) How can we use VB script in testing the application? 2) What all are the things(Software application to be installed in PC) we need to learn VBscript?
How are values assigned to the variables in the vbscript language?