The question was draw a flow chart for whether a number N is Prime or Not. I’m nt able to even start the problem
Solution required for a flow chart question of whether a number N is prime or not
hello @gopsss12
a number n is called prime .
if n is 2
or
it is is not divisible by any numbers in the range [2 … n-1] .
in terms of flow chart->
correction-> k < = n-1
In the flow chart diagram you shared what is flag=0 I just started this course so I don’t know what flag=0 means please explain that to me?
here flag is just acting as an indicator. if its value is 1 then it is indicating that n is not prime ie we have found one value k in range [2…n-1] which divides n.
if it is 0 then it is indicating that n is prime
I do not know what indicators are or their use. Am I supposed to have some Computer Programming per requisite knowledge?Because I was told that this course needs no pre requisite knowledge!
there is no pre requisite .
flag is just a name , u can use any other name of ur choice.
Once n%k==0 is YES shouldn’t the ARROW go to the DESCION BOX instead of K=K+1 because if a number divides N WHY SHOULD WE EVEN HAVE TO INCREASE K AND CHECK FOR OTHER NUMBERS TILL (N-1) because once a number divides N FLAG=1 and we can go to FLAG DESCION BOX where FLAG is not =0 HENCE NOT PRIME IS PRINTED?
there can be multiple flow chart possible.
what u r saying is also correct