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
how to operate webobjects in a webpage using getobject function and then using generic methods?
How to use QTP Object in .vbs(vbscript file) file Ex: Browser().., wait(), exist() and etc...
What aspects of vbscript make it safe so that a web page using vbscript cannot destroy or corrupt information on a user's computer?
What is byref and byval parameters in vbscript?
How will you compare two strings in vbscript?
Mention what is select case statement?
how to automatically update the sql server2005 database records when insert in vb6?
What is the purpose of regexp object in vbscript?
Program to use input box and send even numbers into sheet1 and odd numbers into sheet2 and prime numbers into sheet3 using vbscript(QTP)?
Which function allows you to instantiate an object given its programmatic identifier or progid?
What are events in the vbscript language?
after medical test,when will be the police verification
How to assign a numeric value to a variable?
Why to use option explicit in vb script?
What is loose binding? Why is it not a good practice to use it?