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
I have attended Anovatek Software QTP interview. They will give us computer and one web based application with QTP. We have to automate some records (already updated records or new records) using QTP Data driven testing. But we should use for loop? Can any one know how to do data driven testing using For loop?
Mention what is the use of option explicit in vbscript?
Explain about constants in vb script?
Which constant is used for print and display functions and works as same as pressing enter key?
How to open browser in vb script?
What is difference between vbscript and vba?
What are the environments supported by vbscript language?
Explain about tristate constants in vbscript?
Which object provide information about a single runtime error in a vbscript?
What is the scope of a constant declared using public?
Explain about filter expression?
Which function is used to perform string comparison?
What is the use of the instr function?
Why is error handling required?
why variable name should not exceed 255 characters?