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
Mademuasel [1]
4 years ago
6

What is output by the following program? int i = 7; while (i>=2){System.out.print (i +""); if ((i%3) == 0){ i +2; } else { i/

=2;}}
Computers and Technology
1 answer:
stiks02 [169]4 years ago
6 0

Answer:

The correct answer to this question is: "this program give an error".

int i = 7; //declare a variable(i) and assign value.

while (i>=2) //use loop and check condition.i greater then equal to 2.

{

System.out.print (i +""); //print value of i.

if ((i%3) == 0) //hold remainder

{

i +2; //error.

}

else

{

i/=2; //hold Quotient

}

}

Explanation:

In the above program, there is an error in the if block because it is not the correct way to declare. To use the variable from the correct output we use a variable like this.

Example

int i = 7;

//declare a variable(i) and assign value.

while (i>=2)

//use loop and check condition.i greater then equal to 2.

{

System.out.print (i +""); //print value of i.

if ((i%3) == 0) //hold remainder

{

i =i+2;

}

else

{

i/=2; //hold Quotient

}

}

Output: 732

You might be interested in
Scrabble is a word game in which words are constructed from letter tiles, each letter tile containing a point value. The value o
Fantom [35]

Complete question:

Scrabble is a word game in which words are constructed from letter tiles, each letter tile containing a point value. The value of a word is the sum of each tile's points added to any points provided by the word's placement on the game board. Write a program using the given dictionary of letters and point values that takes a word as input and outputs the base total value of the word (before being put onto a board). Ex:  If the input is:  PYTHON

the output is: 14

part of the code:

tile_dict = { 'A': 1, 'B': 3, 'C': 3, 'D': 2, 'E': 1, 'F': 4, 'G': 2, 'H': 4, 'I': 1, 'J': 8,  'K': 5, 'L': 1, 'M': 3, 'N': 1, 'O': 1, 'P': 3, 'Q': 10, 'R': 1, 'S': 1, 'T': 1,  'U': 1, 'V': 4, 'W': 4, 'X': 8, 'Y': 4, 'Z': 10 }

Answer:

Complete the program as thus:

word = input("Word: ").upper()

points = 0

for i in range(len(word)):

   for key, value in tile_dict.items():

       if key == word[i]:

           points+=value

           break

print("Points: "+str(points))

Explanation:

This gets input from the user in capital letters

word = input("Word: ").upper()

This initializes the number of points to 0

points = 0

This iterates through the letters of the input word

for i in range(len(word)):

For every letter, this iterates through the dictionary

   for key, value in tile_dict.items():

This locates each letters

       if key == word[i]:

This adds the point

           points+=value

The inner loop is exited

           break

This prints the total points

print("Points: "+str(points))

6 0
3 years ago
What is the extension of a BASIC256 program file?​
algol13

Answer:

The extension of a BASIC-256 program file is kbs

4 0
3 years ago
Question # 18
borishaifa [10]

Answer:what qustoin

Explanation:sorry wala yung tanong

6 0
3 years ago
Java’s class Color has a constructor that takes three integers as parameters: the red, green, and blue components of the color
Tanzania [10]

Answer:

    public Balloon(){

          //Invokes the 2 argument constructor for balloon with relevant  

          //parameters

          this(10,new Color(135,206,250));

    }

Explanation:

class Balloon{

    //Private fields in the Balloon class

    private double radius = 0;

    private Color c = null;

    // Constructor with two arguments - radius and Color

    public Balloon(double radius,Color c){

         this.radius = radius;

         this.c = c;

    }

    // No argument constructor

    public Balloon(){

          //Invokes the 2 argument constructor for balloon with relevant  

          //parameters

          this(10,new Color(135,206,250));

    }

}

3 0
4 years ago
What is the best way to beat someone on starve.io? with a lava sword, or a pirate sword.
makkiz [27]

Answer:

Lava sword all the way

Explanation:

fo sho

8 0
3 years ago
Other questions:
  • Any method of determining whether an event or object is older or younger than others
    13·2 answers
  • Which spreadsheet operation does a look function perform?
    5·1 answer
  • Suppose that a computer can run an algorithm on a problem of size 1,024 in time t. We do not know the complexity of the algorith
    14·1 answer
  • A _____________ is a method of controlled entry into a facility and provides access to secure areas such as a research lab or da
    6·1 answer
  • What Does S.T.E.M stand for?​
    8·1 answer
  • An OCA previously classified a recent government breakthrough in energy technology as Confidential. The military is developing a
    9·2 answers
  • Biosolids are used as a chemical free natural choice for fertilizing.
    5·1 answer
  • Mathematics and modern technology​
    14·1 answer
  • A router periodically goes offline. Once it goes offline, you find that a simple reboot puts the router back online. After doing
    12·1 answer
  • ________ is a group meeting-based process for requirements collection. a. Reverse engineering b. Joint application design c. Hum
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!