Prime number | Sololearn: Learn to code for FREE!
Neuer Kurs! Jeder Programmierer sollte generative KI lernen!
Kostenlose Lektion ausprobieren
0

Prime number

write a program which take two input from user if the vale are prime number multiply both numbers if they are not prime divide bhot numbers

19th Oct 2017, 1:27 PM
Badar Bhutta
Badar Bhutta - avatar
5 Antworten
19th Oct 2017, 3:02 PM
Shadow
Shadow - avatar
0
yes this right .but it is too complicated ..
19th Oct 2017, 3:07 PM
Badar Bhutta
Badar Bhutta - avatar
0
can we solve this by...nested if ?
19th Oct 2017, 3:09 PM
Badar Bhutta
Badar Bhutta - avatar
0
Why is this complicated? It is a simple function returning true if the parameter has no other dividents beneath 1 and itself, that you then use with both inputted numbers. If both return true, you multiplicate, else divide. Also I cant see how this would work with nested if-statements...
19th Oct 2017, 3:24 PM
Shadow
Shadow - avatar
0
thanks
19th Oct 2017, 3:26 PM
Badar Bhutta
Badar Bhutta - avatar