Hey, guys, what's up?
So today we will solve one problem, one function.
So the question is right to function.
Would kick.
If I no.
If a number is.
Prime are not.
OK.
So we have to write a function and that function will check if the given number is prime or not.
So how do we check with our number is prime or not?
We will start dividing from two bill and minus one in between these numbers.
If I find any number, if I find just anyone number.
Just any one.
Number.
That divides and that means that number is not prime.
If they were to find any one number in this range that divides and then the number is blame.
OK.
So our aim is to find just one number that divides.
And if we are able to find our frame as prime.
So we have to write the function.
So let's name it.
Function.
Czech Prime Nazi P.P..
So let's see.
My number is in, let's say the number that we have to check will be given by user.
And now what we have to do.
I will write a function is prime.
So if suppose I will function is prime.
So what is parameter take as input.
It will take a number as input.
So if its frame is returning through that means.
My number is frame.
I will print.
See out.
Frame.
And if this function or done falls, that means my number is not fame.
OK, so we have to implement this is prime function.
So they don't type is Moule if they're the modest frame.
I will know if the given number is not prime.
I will return false.
So Boole is there done type of.
Is frame.
It will take a number as input.
So end.
Let's call this number N.
So what do we have to do?
I will start dividing the number from two so far.
And I close too.
I have to go to Bill and minus when I bless Bliss.
So if I am able.
So if I am able to find just one single number that divides in letters is if and Maude I that is if
I do weights in.
So my number is not frame.
So I will return false.
OK.
So if I divide and that means my number is not prime.
And I can return false.
Now when will I reach line number eleven?
So when this full look will terminate, I will reach line number eleven.
OK.
So when this little will dominate, I will reach line number eleven.
So if this loop terminate, what is the meaning?
This means that the number is prime.
I am not able to find just one number that divides.
And so I can return through.
OK, so let's start program.
Let's say the given number is two.
So, too, is prime.
Let's see.
My number is seven.
So seven is also prime.
And let's see.
My number is Ford.
So Ford is not prime.
OK.
So this is how it is.
Plugging bull is the return type is Plame is the name of the function and his barometer or Ganzi argument.
So if any number divides and it unfolds.
Number is not Plame.
Otherwise you can say if Lyttleton true number is Plame.
And here I am checking if is Plame is returning true.
That means my number is Plame.
So I am bringing crime.
Otherwise I will print not brain.
OK.
So this is it for this video.
If you have any doubt, you can ask me.
Thank you.