![]() |
Re: Check if a number is prime or not
You don't need to loop till i but even i/2 or square root of i is also sufficient.
|
Re: Check if a number is prime or not
Yes....the actual is the square root of i. You can use the standard function sqrt(); for that purpose.
|
Re: Check if a number is prime or not
A simple program is here. to chech a number is prime or not.
Code:
void main() |
| All times are GMT +5.5. The time now is 20:21. |