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
Nat2105 [25]
3 years ago
6

Write a program that asks the user to input four numbers (one at a time). After the four numbers have been supplied, it should t

hen calculate the average of the four numbers. The average should then be displayed.
Computers and Technology
1 answer:
nika2105 [10]3 years ago
6 0

Answer:

<u>Output</u>

Enter first number:  

1

Enter second number:  

2

Enter third number:  

3

Enter fourth number:  

4

Average: 2.5

Explanation:

Below is the java program to calculate the average of four numbers:-

import java.util.Scanner;

public class Average {

public static void main(String[] args){

 int a,b,c,d;

 double average=0.0;

 Scanner s=new Scanner(System.in);

 System.out.println("Enter first number: ");

 a=s.nextInt();

 System.out.println("Enter second number: ");

 b=s.nextInt();

 System.out.println("Enter third number: ");

 c=s.nextInt();

 System.out.println("Enter fourth number: ");

 d=s.nextInt();

 average=(a+b+c+d)/4.0;

 System.out.println("Average: "+average);

}

}

You might be interested in
Which of the following mountain ranges stretches from Alabama to Canada?
Vikki [24]
The Appalachian Mountains
4 0
3 years ago
Write a method called printRangeOfNumbers that accepts a minimum, maximum numbers as parameters and prints each number from mini
timama [110]

Answer:

The method in python is as follows:

class myClass:

    def printRange(min,max):

         for i in range(min, max+1):

              print("{"+str(i)+"} ", end = '')

           

Explanation:

This line declares the class

class myClass:

This line defines the method

    def printRange(min,max):

This line iterates from min to max

         for i in range(min, max+1):

This line prints the output in its required format

              print("{"+str(i)+"} ", end = '')

5 0
3 years ago
Which of the following views would you use to see your Web page while working on it?
brilliants [131]
D) Alt Tags thats the answer i think
8 0
3 years ago
What is nested selection?
kodGreya [7K]

Answer:

I think its 4 I'm not so sure though

7 0
3 years ago
Drag the words into the correct boxes
tresset_1 [31]

Explanation:

if you have any doubts or queries regarding the answer please feel free to ask

4 0
2 years ago
Other questions:
  • You are in charge of five software development projects. The project characteristics of each of the sys are as follows:
    13·1 answer
  • What is an examlple of cyberbullying
    5·1 answer
  • One group of students did an experiment to study the movement of ocean water. The steps of the experiment are listed below.
    10·1 answer
  • Which of the following actions might contribute to recommendations you see online?
    6·1 answer
  • In basic network scanning, ICMP Echo Requests (type 8) are sent to host computers from the attacker, who waits for which type of
    14·1 answer
  • Write the proghrams for the following:
    13·1 answer
  • An acronym is a word formed by taking the first letters of the words in a phrase and making a word from them. For example, AGH i
    10·1 answer
  • Which approach does procedural programming follow? bottom up, top down, random, or object oriented​
    15·1 answer
  • What are the odds that you find someone you know in person on here
    5·1 answer
  • In Python, while loops will repeat during the time the test condition is true.
    7·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!