Answer:
procedimento
Explanation:
faz se a montagem conforme mostra a figura.
Answer:
- public class Main {
-
- public static void main (String [] args) {
-
- for(int i = 2; i < 10000; i++){
- if(isPrime1(i)){
- System.out.print(i + " ");
- }
- }
-
- System.out.println();
-
- for(int i = 2; i < 10000; i++){
- if(isPrime2(i)){
- System.out.print(i + " ");
- }
- }
- }
-
- public static boolean isPrime1(int n){
-
- for(int i=2; i <= n/2; i++){
- if(n % i == 0){
- return false;
- }
- }
-
- return true;
- }
-
- public static boolean isPrime2(int n){
-
- for(int i=2; i <= Math.sqrt(n); i++){
- if(n % i == 0){
- return false;
- }
- }
-
- return true;
- }
- }
<u></u>
Explanation:
Firstly, create the first version of method to identify a prime number, isPrime1. This version set the limit of the for loop as n/2. The for loop will iterate through the number from 2 till input n / 2 and check if n is divisible by current value of i. If so, return false to show this is not a prime number (Line 22 - 26). Otherwise it return true to indicate this is a prime number.
In the main program, we call the isPrime1 method by passing the i-index value as an argument within a for-loop that will iterate through the number 2 - 10000 (exclusive). If the method return true, print the current i value). (Line 5 - 9)
The most direct way to ensure all the prime numbers below 10000 are found, is to check the prime status from number 2 - 9999 which is amount to 9998 of numbers.
Next we create a second version of method to check prime, isPrime2 (Line 31 - 40). This version differs from the first version by only changing the for loop condition to i <= square root of n (Line 33). In the main program, we create another for loop and repeatedly call the second version of method (Line 13 - 17). We also get the same output as in the previous version.
Answer:
IBM's own Personal Computer (IBM 5150) was introduced in August 1981, only a year after corporate executives gave the go-ahead to Bill Lowe, the lab director in the company's Boca Raton, Fla., facilities. He set up a task force that developed the proposal for the first IBM PC.
Answer:
6
Explanation:
97+3 = 100
89+11 = 100
83+17 = 100
71+29 = 100
59+41 = 100
53+47 = 100
I counted them using excel, see pic.
Question Completion with Options:
a. Translation of the entire L1 program into L0 code
b. Translation of the L0 program into L1 code
c. Creation of a language L3 that interprets L0 instructions
d. Interpretation of each L1 statement using L0 code as the L1 program is running.
Answer:
The important operations that must take place in this scenario are:
a. Translation of the entire L1 program into L0 code
d. Interpretation of each L1 statement using L0 code as the L1 program is running.
Explanation:
Translation enables decoding to take place. This means that the L1 program is decoded into a language that the L0 program can understand and execute. Without this translation, the higher level language of L1 will not be understood by the machine language of the L0 programs. Translation of a code creates a shared understanding, thereby easing program execution. Code translation is simultaneously accompanied by interpretation.