Question: plz use java Assume we have already defined a variable of type int called num with the following line of code: int num =' ???;
plz use java
Assume we have already defined a variable of type int called num with the following line of code: int num =' ???; // 'num' can have any int value TASK: Print the sum of the prime numbers that are less than or equal to num. You may assume that num is greater than 1. HINT: Recall that a number is considered "prime" if it is only divisible by 1 and itself. HINT: 1 is not a prime number. HINT: You can use Math.sqrt(x) to take the square root of a variable x. No need to import anything: we've done that for you behind- the-scenes. Sample Input: 10 Sample Output: 17 Write a program, test using stdin stdout Time limit: 8 seconds Memory limit: 256 MB
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
