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
What are keywords in the vbscript language?
Explain a few date functions in vbscript
How to create a cookie using vbscript?
By default in vbscript the arguments passed to functions and subroutines are by reference or by value?
What are events in the vbscript language?
hi i am trying for testing job for 3+ experience(fake) can u suggest me what type of projects i can keep in my resume and how much of knoeledge i should have abt that project.thnks in advance.urgt plz
How should i Create Email invite with server-side Coding?
What are the properties of regexp object?
why variable name should not exceed 255 characters?
Mention the rules for using option explicit statement?
In html file what is an ideal position to include vbscript?
Write a code to print numbers from 5 to 0?
how to increasing the numbers in a given text box please write a vb script
Can someone please tell me what poor design in a relational database (not the layout or style) is and how it can be avoided? PLEASE...im desperate.
how to set one column as primary key in QTP and fetch values accordingly