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
Which date function is used in the vbscript language to find the difference between the 2 dates?
after medical test,when will be the police verification
What is Procedure or Subroutine in VB Script?
If we take 2 strings as “good” and “bad” then what will ‘+’ and ‘&’ operators return?
Write program for identifyig duplicates in flight Departing from and Arriving in mercury tours(web application).
Which in-built function related to an array joins substrings into one string in the vbscript language?
Explain the filter expression?
how to write codings in QTP using vb script. please help me. i am new to QTP. it is easy or very much tough. please tell me
How to open excel in vb script?
wat is the com(common object model)object for mozilla firefox???????plz if any one know the exact answer....reply me......
How to create a function in vbscript?
How will you get the largest subscript of an array in vbscript?
Why is the use of exit do or exit for statements within loops discouraged?
What is vbscript language used for and which earlier language is it modeled upon?
What is the difference between for loop and while loop?