Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

Which date function is used in the vbscript language to find the difference between the 2 dates?

1117


after medical test,when will be the police verification

2223


What is Procedure or Subroutine in VB Script?

1208


If we take 2 strings as “good” and “bad” then what will ‘+’ and ‘&’ operators return?

1029


Write program for identifyig duplicates in flight Departing from and Arriving in mercury tours(web application).

1959


Which in-built function related to an array joins substrings into one string in the vbscript language?

997


Explain the filter expression?

1154


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

14352


How to open excel in vb script?

1076


wat is the com(common object model)object for mozilla firefox???????plz if any one know the exact answer....reply me......

1934


How to create a function in vbscript?

1310


How will you get the largest subscript of an array in vbscript?

1222


Why is the use of exit do or exit for statements within loops discouraged?

1093


What is vbscript language used for and which earlier language is it modeled upon?

1061


What is the difference between for loop and while loop?

1133