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
kodGreya [7K]
4 years ago
12

What is one potential problem with the following loop? System.out.print("Enter integers. Enter -1 to exit."); System.out.println

(" Count of integers entered will be returned."); int n=0; int c=0; while (n != -1) { n = scan.nextInt(); c++; } System.out.println(c);
Computers and Technology
1 answer:
iris [78.8K]4 years ago
7 0

Answer:

The answer to this question can be given as  

The potential problem with the loop is it's counts when the user enters -1 from the keyboard, so the count will too many.

Explanation:

In the program there some line is missing. So the right program of the  question can be given as:  

import java.util.*;     //import package for take input from user.

public class Main     //define main class.

{

public static void main(String[] args)//define main function

{

Scanner scan=new Scanner(System.in);          //creating object.

//print values.

System.out.print("Enter integers. Enter -1 to exit.");

System.out.println(" Count of integers entered will be returned.");  

 int n=0,c=0;           //declaring integer variable.

  while (n != -1)             //loop

   {

       n = scan.nextInt();               //take input by user and hold on variable n.  

       c++;

   }

 System.out.println(c);               //print value.

}

}

output:

Enter integers. Enter -1 to exit. Count of integers entered will be returned.

-1

1  

You might be interested in
Which best describes a difference between transcription and DNA replication
ruslelena [56]
DNA replication is just making a copy of someone or somethings DNA
6 0
3 years ago
Read 2 more answers
Which of the following is used by credit card companies to determine APR?
kodGreya [7K]
Prime rate + credit history (APEX)
4 0
3 years ago
Read 2 more answers
Will give brainliest!!!!!!!!
dolphi86 [110]

Answer:

d the overall strength of colours

Explanation:

7 0
3 years ago
Read 2 more answers
Complete each sentence to describe different elements of an Excel worksheet.
barxatty [35]

Answer:

Answer is - cell, - column, - string value

Explanation:

  • <em>Cell - this is often referred to as the intersection of a single row and column.  </em>
  • <em>Column - this is a group of cells which are represented vertically.  </em>
  • <em>String - these are values that are inside the cell which are represented through texts or group of letters including acceptable symbols and characters.</em>
7 0
3 years ago
Read 2 more answers
The term drive app is used to describe applications stored on a computer true or false
Volgvan
Hello <span>Areyano7475
</span>

Question: T<span>he term drive app is used to describe applications stored on a computer true or false


Answer: False


Hope this helps
-Chris</span>
7 0
3 years ago
Read 2 more answers
Other questions:
  • Your friends know that you understand a lot about computers, both the technical details of how they operate as well as informati
    12·1 answer
  • When planning a backup strategy, ideally one needs to prioritize important data and only back up what is absolutely necessary fo
    15·1 answer
  • Plz help fast! will mark brainliest!<br><br>List three ways that music is used in modern society.
    6·1 answer
  • The wildcard character * (asterisk/start) and ? (question mark) are the same and can be use interchangeably.
    6·1 answer
  • The table button is present in the ……… tab.​
    14·2 answers
  • Meta is a penetration testing engineer assigned to pen test the security firm's network. So far, she cannot tunnel through the n
    12·1 answer
  • A web application with an SQL server database is found to be compromised by an attacker. On examination, the email IDs of the da
    5·1 answer
  • Suppose we used an internet addressing protocol that used 4 bits to encode a single address. How many devices would be supported
    15·1 answer
  • Consider a game that is searched using random restart hill climbing strategy. Assume that the success rate for the game is 25%.
    12·1 answer
  • Ginny faced an application error while executing the recorder in opera. Which web browser is generally recommended to use with r
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!