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
Why is error handling required?
What is loose binding? Why is it not a good practice to use it?
How will you format a number in percetage format in vbscript?
How will you get a combined string from array of string in vbscript?
where can i learn VB scripint ?
What is event handling in vbscript?
Explain the scope of the variables using dim, public, and private keywords respectively.
how to acces the remote mechine using vb cript(QTP)
What is the difference between vb debugger and the script debugger?
Mention what if you do not specify anything when you call a procedure?
How to Import data from a file (file is on the desktop) to the data table
What is the event handling in vbscript?
How do i automate a website www.flyashx.com without having any test cases witin a week time.
what is inner join? what is outer join? what is a constraint? tell me about rdbms? tell me about acid properties?
Explain about the functionality of vb script?