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
Naily [24]
3 years ago
8

Write a program that reads an unspecified number of integers, determines how many positive and negative values have been read, a

nd computes the total and average of the input values (not counting zeros). Your program ends with the input 0. Display the average as a floating-point number. Sample Run 1
Computers and Technology
1 answer:
nika2105 [10]3 years ago
3 0

Answer:

import java.util.Scanner;

public class NumbersStats {

   public static void main(String[] args) {

       Scanner in = new Scanner(System.in);

       int pos = 0, neg = 0, count = 0, num;

       double total = 0;

       System.out.print("Enter an integer, the input ends if it is 0: ");

       while (true) {

           num = in.nextInt();

           if(num == 0) break;

           if(num > 0) {

               pos++;

           } else {

               neg++;

           }

           total += num;

           count++;

       }

       System.out.println("The number of positives is " + pos);

       System.out.println("The number of negatives is " + neg);

       System.out.println("The total is " + total);

       System.out.println("The average is " + (total/count));

   }

}

Explanation:

You might be interested in
What date does GTA 6 come out<br> A. 2020<br> B. 2019<br> C. 2021<br> D. 2022
timofeeve [1]

it is a okkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk

7 0
3 years ago
Read 2 more answers
You are setting up a small network. The customer has decided to change his internet service provider (ISP) to EtherSpeed. The IS
salantis [7]

Home pc1 becouse it is the right one

3 0
2 years ago
T F The exit function can only be called from main .
ElenaW [278]

Answer:

FALSE

Explanation:

The exit function is used to terminate or halt the process.

Syntax-

            void exit(int status)  

Exit function (exit()) can be used in any function not only main() and it will terminate your whole process.

<u></u>

<u>Example-</u> C Program

#include<stdio.h>

#include <stdlib.h>  

//  function declaration

float exitexample ( float x );                                

// Driver program

int main( )                

{

 float a, b ;

 printf ( "\nEnter some number for finding square \n");

  scanf ( "%f", &a ) ;

 // function call

 b = exitexample ( a ) ;                      

 printf ( "\nSquare of the given number %f is %f",a,b );  

/*This will not printed as exit function is in exitexample() function*/

}

float exitexample ( float x )   // function definition  

{

 exit(0);    //exit function

   float p ;

  p = x * x ;

return ( p ) ;

}

5 0
3 years ago
Explain how communication has helped to the staff in organization to reach their maximum delivery of service with efficience and
Gwar [14]

Answer:

i don't know

Explanation:

6 0
2 years ago
Your location has been assigned the 172.149.254.0 /24 network. You are tasked with dividing the network into 13 subnets with the
ira [324]
  • The subnet mask would be a 32-bit integer which is formed by assigning the host bits to all 0's and the networking bits to so many 1's.
  • In this method, the subnetting separates the IP address between host and network addresses.
  • The subnet mask covers an IP address with its 32-bit number, thus the term "mask".

Given:

Network IP address \bold{= 172.149.254.0 /24}

Subnet numbers \bold{= 13}

Calculating the borrow bits:

\to  \bold{= ceil(\log_{2} 13) = 4 \ bits}

a)

Calculating the dotted decimal value for the subnet mask:

\to \bold{11111111.11111111.11111111.00000000}\\\\\to \bold{255.255.255.240}\\\\

b)

The additional bits which will be needed to mask the subnet mask that is = 4.

Learn more: brainly.com/question/2254014

4 0
3 years ago
Other questions:
  • Plz answer me will mark as brainliest ​
    7·2 answers
  • A person painting his house dumps the unused paint on the ground. Which of the following resources will this most likely pollute
    14·1 answer
  • Implement the RC4 stream cipher in C++. User should be able to enter any key that is 5 bytes to 32 bytes long. Be sure to discar
    7·1 answer
  • Plymouth Colony was originally founded by a group of people called Pilgrims. Since Plymouth did not have an official charter fro
    15·1 answer
  • How many of yall are willing too sub to my channel called "Space Juice" with around 200 subs?!​
    6·1 answer
  • If we ignore the audio data in a video file, a video file is just a collection of many individual frames (i.e., images). What is
    6·1 answer
  • NO LINKS OR SPAMS THEY WILL BE REPORTD<br><br> Click here for 50 points
    5·2 answers
  • PLS HELP WITH MY PYTHON HW ILL GIVE YOU BRAINLIEST
    12·1 answer
  • How to create drop down list in excel with multiple selections.
    13·2 answers
  • Which option is an example of an algorithm that is used in daily life?
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!