Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 

Repository files navigation

organizeInputs

Write a program that gets ten whole numbers from the user and displays a count of: the number of zeroes, the number of negative values, and the number of positive values entered, followed by the product of the negative numbers entered, and the sum of the positive values entered. Use a for loop to control the number of iterations.

Use ints for the variables in the program.

Failure to follow the requirements for lab lessons can result in deductions to your points, even if you pass the validation tests. Logic errors, where you are not actually implementing the correct behavior, can result in reductions even if the test cases happen to return valid answers. This will be true for this and all future lab lessons.

Display Details Make the output look like the following in your IDE. Note: There is one tab at the beginning of the lines showing the number of 0’s, number of positive values, and number of negative values.

There is also a blank line before the product.

Do not forget to display a newline at the end of your output.

Recall that Zylabs uses preprogrammed inputs, so the values entered by the user and the newline generated when the user presses enter are not displayed in Zylabs.

Sample Output:

Enter whole number 1: 18
Enter whole number 2: -4
Enter whole number 3: -6
Enter whole number 4: -7
Enter whole number 5: 19
Enter whole number 6: 0
Enter whole number 7: 0
Enter whole number 8: 2
Enter whole number 9: -2
Enter whole number 10: -6

Of the 10 numbers entered:
    2 were 0's.
    5 were negative.
    3 were positive.

The product of the negative numbers was -2016.
The sum of the positive numbers was 39.

About

3.17 Laboratory Exercise #17 (for Loop): CS 1436

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages