Posts by Nelson D'Vasconcelos • 35 points
3 posts
-
-2
votes2
answers1867
viewsQ: Create an algorithm, in JS, to list all primes smaller than or equal to N
I need to create an algorithm in Javascript, to list all prime numbers less than or equal to a given number. function primeNumber (num){ var num = 0; for (var i = 0; i <= num; i++){ if ((num % 1…
-
-1
votes2
answers5514
viewsQ: How to simplify the logical expression (~x Ʌ ~y Ʌ ~z) V (x Ʌ ~y) V (z Ʌ ~y)?
I came across the following question of logic in a leveling test that I did not know how to solve... could someone explain me the reasoning of the question? Whereas x, y and z are simple…
-
1
votes2
answers116
viewsQ: How to create a factorial function using the 'for' counter?
Let’s get to the point: I would like to create a factorial function using the counter for calculating the factor of the parameter numero. Remembering that 0! = 1 and 1! = 1. My code is like this:…