0
Help my exercise.
Design an algorithm to determine if a number is a prime number. how if the input is : n>0 output : prime/non-prime
6 Answers
+ 1
Yeah sorry about it. thank before for answering my questions. but. i tried type 0,1,2,7 as input, but the output still same "prime number"
+ 1
Sterben Auf
Well, yes, the code was working for values > 2.
2 and 7 are prime numbers. The code works correctly here. In case of 0 and 1, I have modified the code now, check this out once again, it should say that 0 and 1 are non-prime.
If you are looking for more non-prime numbers, try to input 4, 6, 8, 9, 10, 12...
Does it meet your expectations now? :)
0
Sterben Auf Could you clarify your question, please?
0
This worked fine for me:
https://code.sololearn.com/c5SnITF8eq0y/#cpp
Let me know if you find any errors.
0
thank u very much :)