IsPrime Function Explanation needed
Go to solution
Solved by mansoor_,
bool is a type of data (boolean) that takes the values true or false.
(hence the syntax [bool Varname] : defines a boolean variable Varname)
In this code the variable primeflag, is a boolean variable,
The initial batch of code checks whether the number (k, which the loop is currently on),
is a prime number [if (number % i == 0)]
if so, then primeflag will be true, and the number (k) will be printed.

Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now