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
Ganezh [65]
4 years ago
8

Write a program that computes the average of a list of numbers entered by the user. The numbers are supposed to be in the range

50 – 100 (inclusive) and the user will indicate that he/she is done with data input by entering a value not in that range. At least one number will be in the range. Use a WHILE or a DO-WHILE loop.
Computers and Technology
1 answer:
Maru [420]4 years ago
8 0

Answer:

The answer to this question can be given as:

Program:

//import package.

import java.util.*;  

public class Main      //define the main class.

{

public static void main(String[] ar) //define main method.

{    

    int sum=0,avg=0,count=0,data;  //define varaible

    // Create a Scanner class object.    

    Scanner ob1 = new Scanner(System.in);  

    System.out.println( "enter number between 50 - 100 After done please insert 0:"); //message

    data = ob1.nextInt();  //input by user.  

    while (data >50 && data<100)   //number between 50 to 100

    {

        if(data!=0)  //condition

        {

            sum =sum+ data;        //add numbers.    

            data = ob1.nextInt();   //next input

            count++;  //count number.

        }

    }      

    System.out.println("The sum is :" + sum);  //print sum.

    avg=sum/count;

    System.out.print("The average is :" + avg);  //print average.

}

}

Output:

enter number between 50 - 100 After done please insert 0:

80  

89

90

96

66

89

0

The sum is :510

The average is :85

Explanation:

In the above program firstly we import java util package. This package is used to take input from the user. Then we declare the class that is main in this class we define the main function in the main function we define the variable that is sum, avg, count, and data. In the data variable, we take the input from the user. Then we define the while loop in this loop we define condition that number is greater then 50 and less than 100.in this loop we define if block in the if block we check that the number is not equal to 0. so it will sum all the elements and count the number inserted by the user. In the last, it will print the sum of the number and the average of the number.

You might be interested in
The report Jamie created has a dark background and the page number is not displaying correctly. Which formatting option would he
Readme [11.4K]
The Font Color <span>formatting option would be needed to apply to the page number to add contrast between the background and the page number</span>
8 0
3 years ago
What is a slide show
STALIN [3.7K]
A slide show is a presentation supplemented by or based on a series of projected images or photographic slides.
7 0
4 years ago
Read 2 more answers
You hide three worksheets in a workbook and need to unhide them. What is an accurate statement about this process?
Fofino [41]

The  accurate statement about this process is that "The person must unhide each worksheet separately".

<h3>How do you unhide multiple sheets in Excel?</h3>

To unhide multiple sheets, one can:

  • Right-click the Sheet tab at the bottom, and then click on  Unhide.
  • Then also click all together the Shift + Up/Down Arrow keys to click multiple (or all) worksheets, and then click OK.

Note that The  accurate statement about this process is that "The person must unhide each worksheet separately".

Learn more about worksheets  from

brainly.com/question/25130975

#SPJ12

8 0
2 years ago
Which of the following is NOT a benefit of virtual memory? speed up of process creation increases in the effective access time o
lubasha [3.4K]

Answer:

speed up of process creation increases in the effective access time of memory

Explanation:

Virtual memories are often used in order to save up ram for other applications and not being limited by the actual physical memory that we have, in this case the virtual memory is slower than normal memories since they are not actual memories and are restricted to the spee of the connection or the speed of the disk where they are located.

8 0
3 years ago
Combining two or more selected cells into one cell is called _____ cells.
Lisa [10]
The answer is group cells
7 0
3 years ago
Other questions:
  • He ____________ may include a high-level WBS in a graphic chart format or as an indentured list of the work elements and associa
    14·1 answer
  • What is an establishing shot, and when is it an appropriate shot choice in a film?
    15·2 answers
  • Explain where and why metallic material or non metallic material have been used in your home​
    8·1 answer
  • Which folders are commonly used in the navigation pane of outlook
    5·1 answer
  • ConnectWeb, Inc., an Internet service provider (ISP), supplies information to the Federal Trade Commission concerning possible u
    13·1 answer
  • The while loop has two important parts: (1) a boolean expression that is tested for a true or false value, and (2) a statement o
    6·2 answers
  • After submitting a résumé by mail, how long should you wait before following up with an employer? a. 1 day b. 2-3 days c. 1 week
    9·1 answer
  • What are concepts and accrual​
    9·2 answers
  • Circuit pruning occurs only before puberty.<br> O True<br> O False
    9·2 answers
  • A time management tool in a help desk software package probably has the greatest impact on the productivity of _____.
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!