1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
konstantin123 [22]
3 years ago
11

As in previous prelabs, you can enter all the necessary Java code fragments into the DrJava Interactions pane. If you get an err

or, enter the corrected code. If you get really mixed up, you can reset the interactions pane and try again. Write a while loop that computes the sum of the first 10 positive integers. Write a for loop that computes the sum the first 10 positive integers. For each loop, you should use two variables. One that runs through the first 10 positive integers, and one that stores the result of the computation. To test your code, what is the sum of the first 10 positive integers
Computers and Technology
1 answer:
yuradex [85]3 years ago
5 0

Answer:

public class Main{

public static void main(String[] args) {

 //The While Loop

 int i = 1;

 int sum = 0;

 while(i <=10){

     sum+=i;

     i++;  }

 System.out.println("Sum: "+sum);

 //The for Loop

 int summ = 0;

 for(int j = 1;j<=10;j++){

     summ+=j;  }

 System.out.println("Sum: "+summ); } }

Explanation:

The while loop begins here

 //The While Loop

This initializes the count variable i to 1

 int i = 1;

This initializes sum to 0

 int sum = 0;

This while iteration is repeated until the count variable i reaches 10

 while(i <=10){

This calculates the sum

     sum+=i;

This increments the count variable i by 1

     i++;  }

This prints the calculated sum

 System.out.println("Sum: "+sum);

The for loop begins here

 //The for Loop

This initializes sum to 0

 int summ = 0;

This iterates 1 through 10

 for(int j = 1;j<=10;j++){

This calculates the sum

     summ+=j;  }

This prints the calculated sum

 System.out.println("Sum: "+summ); }

You might be interested in
If you don't know whether to write too, two, or to, you should use the spell-checker to help you decide. true or false?
Charra [1.4K]
I can see this going two ways

-True, if you are not sure if you've used the right kind of spelling for that sentence and want an instant proof read.

-False, there's a chance it can get it wrong so you should ask another person for help.

Take you pick on either one.
4 0
3 years ago
It takes an older computer twice as long to send out a company's email as it does a newer computer. Working together, it takes t
bulgar [2K]

Answer:

13,33  MIN.

Explanation:

1. Time with Older Computer (OC) = 2 time with New Computer (NC)

2. OC+ NC = 10 MIN.

replacing 1. in 2.    OC + OC/2 = 10 min.  

1.5 OC =10min

OC=6.66 MIN

NC = 3,33 MIN.

If we replace NC with OC , 3,33 min will take 2 times (6,66 min)

Total Time = 6,66 + 6,66= 13,33 min

4 0
3 years ago
sharon gives a thumbs-up to her little brother who has just scored in his schools basketball game. sharon is communicating by us
stellarik [79]
She is communicating by using a gesture...
Please mark as brainliest...
6 0
4 years ago
Read 2 more answers
Please please help I don’t understand this please.
PIT_PIT [208]

Answer:

first the class declaration (the bit with class player)

then the object creation (myPlayer = player())

then assigning a value to a property (myPlayer.life=4)

Explanation:

You have to declare the class before you can use it.

You have to create an object before you can access its members.

Unclear why in the exercise second and first are swapped...?

3 0
3 years ago
_KOH + _Cu(CIO3)2 - __KCIO3 +<br>_Cu(OH)2​
Lyrx [107]
K- 1 x 2 =2
OH- 1 x 2 = 2
Cu- 2
(CIO3)- 6

K- 1 x 2= 2
OH- 2
Cu- 2
(CIO3)- 3 x2=6

2KOH+ Cu(CIO3)2 - 2KCIO3+ Cu(OH)2
8 0
3 years ago
Other questions:
  • System uses a 6-bit 2’s complement signed integer representation. What is the range of decimal values it can represent?
    14·1 answer
  • Advancements in technology that might be helpful for individuals who need accommodations to perform computer tasks include _____
    15·2 answers
  • What is the very first thing a user usually must do to gain access to a secure computer?
    7·1 answer
  • 7. When using find command in word we can search?
    7·1 answer
  • In which job role would a course in 3D modeling help with professional career prospects?
    9·2 answers
  • Write a SELECT statement that uses an aggregate window function to get the total amount of each order. Return these columns: The
    13·1 answer
  • Fill up the blank:- The picture that graphically represents the items you use in Windows is called a/an .......
    5·1 answer
  • Give 4 examples of mnemonic codes, and what do they do?
    15·1 answer
  • Dora has inserted a text box into a Word document that she is formatting. Which strategy will not format text boxes? Create a li
    6·2 answers
  • Davingould1115...................answer 3​
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!