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 / sumit
//An Extremely Efficient method.
void chkprime(int n)
{
int i=2,j=1;
for(;i<=n/i;j++,i++)
{
if (n%i == 0)
{
break;
}
}
if ( n%i != 0 )
printf("%d is prime. Comparisons: %d\n",n,j);
}
Is This Answer Correct ? | 2 Yes | 0 No |
Post New Answer View All Answers
create a form to accept username and password validate the username and password with using message box, display the corresponding user message
What is the use of the formatdatetime function in the vbscript language?
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.?
Can anyone send me a vb script function for verifying the functionality of active links on a web page
How to delete a cookie using vbscript?
What are the 2 ways to pass a value to the function?
What is the difference between for loop and while loop?
How will you reverse a string in vbscript?
how to increase the values in text box in a given text box increament by two values by clicking on button
Capture the Unique label changes on google home page for I am feeling lucky button and save those label changes to Notepad Note: Using QTP
can anyone send me a vb scripts code for clicking on a link and coming back on home page again does the same for many links on a web page.
What is the difference between VBScript and JavaScript?
How will you get the natural logarithm of the given number in vbscript?
What is the use of the recordset object and which statement is used to create such an object?
How can you destroy an object in vbscript?