computer scince
Chat with our AI personalities
loop i from 0 to num check if num mod i equals 0breakelsesum = sum + numend the loopprint the sum
Usually, in code, the square root symbol is denoted as: sqrt() where the number inside the square root is written inside the brackets. For example, if you wanted the square root of 64, write: sqrt(64)
The Julia can be generated by a quadratic equation in the complex plane. Select a complex number c. Then for a point z in the plane, carry out the iteration, zn+1 = zn2 + c. Colour-code the point according to how many iterations are required before its magnitude exceeds any given threshold. Repeat for all z in the region of the plane.
You can represent an algorithm by three different ways: 1. Pseudo Code 2. Structured flow charts 3. Actual code
It sounds like you're using Java, so instead of pseudo-code, I'll give you the actual code. LinkedList<Integer> l; // Let's assume you have a bunch of Integer values in this list. for (int i = 0; i < l.size(); i++){ int n = l.get(i); boolean prime = true; for (int i = 2; i < n; i++){ if (n % i == 0){ prime = false; break; } } if (prime){ l.remove(i); i--; } }