Question

In: Computer Science

Input 100 numbers and find and output how many numbers are positive and negative, find and...

Input 100 numbers and find and output how many numbers are positive and negative, find and output average of these numbers
Write using vb.net

Solutions

Expert Solution

Here is the solution to above problem . PLEASE GIVE A THUMBS UP!!!

Read the code comments for more information

VB.NET CODE


Module VBModule
Sub Main()
Dim a as Integer ' a to iterate the loop
Dim neg as Integer ' neg to store number of negative numbers
Dim pos as Integer ' pos to store number of positive numbers
Dim sum as Integer ' sum to store the total sum of all numbers
Dim x as Integer ' x to take user input
sum=0
neg=0
pos=0
' loop of size 10 u can edit it to make 100 just chane To 100
For a = 1 To 10 Step 1
' input
Console.WriteLine("Enter a Value: ")
x= Console.ReadLine()
' checking if negative or positive
If (x<0) Then
neg=neg+1
Else
pos=pos+1
  
End If
'adding to sum
sum=sum+x
Next
' printing the answer
Console.WriteLine("Average: {0}", x/10)
Console.WriteLine("Negative Num: {0}",neg)
Console.WriteLine("Positive Num: {0}",pos)
  
End Sub
End Module

SCREENSHOT OF OUTPUT


Related Solutions

How can I explain these numbers in terms of the trends and positive/negative nature of the...
How can I explain these numbers in terms of the trends and positive/negative nature of the ratios? Work Capital $        9,351 $        7,478 $        6,466 Current Ratio                 1.3 1.3 1.2 Accounts Receivable 9.4 10.7 10.5 Days Sales in RA 38.8 34.0 34.6 Inventory Turnover 5.0 5.9 5.8 Days Sales in Inventory 73.4 61.8 62.7 Times Interest Earning 8.0 11.1 11.2 Free Cash Flow 5,320 6,534 7,975 Profitability Measure Cross Profit Margin 62.6% 60.7% 60.5% Rreturn On Assets ROA 1.4%...
A matlab program to enter N numbers and count the positive, negative and zero numbers. Then...
A matlab program to enter N numbers and count the positive, negative and zero numbers. Then print the results
python: ask the user to input a sequence of positive numbers. the end of the sequence...
python: ask the user to input a sequence of positive numbers. the end of the sequence is determined when the user enters a negative number. print out the maximum number from the sequence. output: keep entering positive numbers. to quit, input a negative number. enter a number: 67 enter a number: 5 enter a number: 8 enter a number: -3 largest number entered: 67 (note: i do not want to ask the user how many numbers they will input)
Ask the user to input a series of numbers, write a C# program to output the...
Ask the user to input a series of numbers, write a C# program to output the sum, max, and min. Be sure to do error checking if the user input is not a number.
Find the positive numbers x, y and z whose sum is 100 such that x^r y^s...
Find the positive numbers x, y and z whose sum is 100 such that x^r y^s z^t is a maximum, where r, s and t are constants.
Design the numbers of reinforcing bars required for negative and positive moment that can be utilized...
Design the numbers of reinforcing bars required for negative and positive moment that can be utilized for an overhanging beam with service loads (DL + LL) excluding weight of the beam 40 kN/m loading. The distance separating the supports hinge and roller is 7.20 m while from the roller to the free end is 1.8 m. The given dimensions for the beam are breadth b = 300 mm and depth d = 550 mm. The strengths of the concrete and...
Please fill in the below blanks regarding economic decisions and their impacts (positive or negative): Input...
Please fill in the below blanks regarding economic decisions and their impacts (positive or negative): Input Decision Impact (positively / negatively) A Decrease in the Government Spending impacts , but affects _______ . An Interest Rate cut impacts GDP Growth ___________. An Increase in the Income Tax Rate impacts ___________________________ , and ________________________ . A Decrease in the Corporate Tax rate increases the ________________________________, but decreases ____________________________. Inflation can be increased by _______________________________.
In python, write a function, called ThreeSum, that accepts a list of non-negative numbers as input,...
In python, write a function, called ThreeSum, that accepts a list of non-negative numbers as input, and returns the highest sum of three neighboring elements in it. Write a main method that initializes the following five lists, gets the ThreeSum result for all of them using the above function, and prints the result to the screen. Example of the output: List 1: [4,5,4,5] , Three sum = 14 List 2: [7] , Three sum = 7 List 3: [ ]...
Write a Python program which takes a set of positive numbers from the input and returns...
Write a Python program which takes a set of positive numbers from the input and returns the sum of the prime numbers in the given set. The sequence will be ended with a negative number.
Describe how to turn a negative photoresist into a positive.
Describe how to turn a negative photoresist into a positive.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT