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%...
What are positive and negative reinforcement? How are positive and negative reinforcement different? How are they...
What are positive and negative reinforcement? How are positive and negative reinforcement different? How are they similar? What is punishment?
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
Write a java code to find the following. For numbers 501 to 999, how many numbers...
Write a java code to find the following. For numbers 501 to 999, how many numbers will have the sum of the digits equal to 10. 501, sum of digits=6 502, sum of digits=7 503, sum of digits=8 504, sum of digits=9 505, sum of digits=10 506, sum of digits=11
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.
Given an array of positive numbers and a positive number S, find the length of the...
Given an array of positive numbers and a positive number S, find the length of the smallest contiguous subarray whose sum is greater than or equal to S. Return 0, if no such subarray exists. Example 1 Input: [2, 1, 5, 2, 3, 2], S=7 Output: 2 Explanation: The smallest subarray with a sum great than or equal to '7' is [5, 2]. Example 2 Input: [2, 1, 5, 2, 8], S=7 Output: 1 Explanation: The smallest subarray with a...
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.
What is the limiting factor in determining how many input/output ports a processor can access? A:...
What is the limiting factor in determining how many input/output ports a processor can access? A: the number of bits allocated to a port instruction B: the number of bits in the port address C: the number of bits supported by the data bus D: the number of bits supported by the address bus E: There are no limiting factors
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...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT