Using Racket Create a Racket procedure compute_pos that reads numbers from the keyboard until 0 is read, count how many positive numbers are read, and also compute the sum of only positive numbers, and display the count and the sum of positive numbers in different lines. Note that 0 is not included in the computations.
For example, if user enters:
3
6
-4
12
15
-9
-24
4
-3
-5
1
0
then your procedure should print
positive count: 6
positive sum: 41
You need to utilize “display” procedure to display the count and the sum, and also utilize “read” procedure to keep reading the next number from the keyboard.
#lang racket/base
;attaching package for while loop
(require dyoo-while-loop)
;defining variable to find sum
(define possum 0)
;defining variable to find the count
(define poscount 0)
;stating while loop
(define (compute_pos)
(while #t
;reading the values from console
(define val (read))
;checking the condition
(cond
;if it is positive value
[(positive? val)
;adding the value to sum variable
(set! possum (+ possum val))
;incrementing the count variable by 1
(set! poscount (+ poscount 1))
])
;if the value read is 0 then break
(when (equal? 0 val) (break))
))
;printing the final values of sum and count
(compute_pos)
(display "Positive count:")
(displayln poscount)
(display "Positive sum:")
(displayln possum)

If you have any doubts please comment and please don't dislike
Using Racket Create a Racket procedure compute_pos that reads numbers from the keyboard until 0 is...
using c++ write a program that reads numbers from the user until the user enters a Sentinel. Use a Sentinel of -999. Ignore all negative numbers from the user input. Do the following: must use loops and numbers to do this 1. Output the sum of all even numbers 2. Output the sum of all odd numbers 3. Output the count of all even numbers 4. Output the count of all odd numbers
Write a ( JAVÅ) program which reads (from the keyboard) numbers (doubles) until a zero is input and computes the maximum and minimum of all the read numbers (excluding the terminating zero). Note: you must allow for negative as well as positive numbers. Hint: look at java.lang.Double.MAX_VALUE and java.lang.Double.MIN_VALUE.
using c++ write a program that reads numbers from the user until the user enters a Sentinel. Use a Sentinel of -999. Ignore all negative numbers from the user input. Do the following: 1. Output the sum of all even numbers
1. Draw a complete and neat flowchart that reads ? real numbers from the keyboard, calculate the sum of these ? real numbers, and output the sum to the monitor screen. The integer ? is read from the keyboard. You may use Visio, Word or sketch by hand neatly. Hint: Ask the user to enter the total number of integers first, read the number to variable ?, and then use an ? -iteration loop to read and accumulate each real...
3. Write a Java method (called sumOfSquares) that reads in a sequence of integer numbers using a Scanner object. As each integer is read, the method displays that integer. The method also accumulates the sum of the squares of the integers and displays the sum when all integers are read. The method reads integers until a negative integer is read. The negative integer should not be display or added to the sum of squares. The method will not return a...
Exercise 1: Write a program which repeatedly reads numbers until the user enters "done". Once "done" is entered, print out the total, count, and average of the numbers. If the user enters anything other than a number, detect their mistake using try and except and print an error message and skip to the next number. Enter a number: 4 Enter a number: 5 Enter a number: bad data Invalid input Enter a number: 7 Enter a number: done 16 3...
in C
The preceding LML program reads two numbers from the keyboard and determines and prints the larger value. Note the use of the instruction +4107 as a conditional trans- fer of control, much the same as C's if statement. In-Class Tasks Write LML programs that accomplish each of the following tasks: Use a sentinel-controlled loop to read 10 positive integers and compute and print their sum 1. 2. Use a counter-controlled loop to read seven numbers, some positive and...
Description: Create a program called numstat.py that reads a series of integer numbers from a file and determines and displays the name of file, sum of numbers, count of numbers, average of numbers, maximum value, minimum value, and range of values. Purpose: The purpose of this challenge is to provide experience working with numerical data in a file and generating summary information. Requirements: Create a program called numstat.py that reads a series of integer numbers from a file and determines...
Write a program that reads a positive integer N, where N is greater than 1 and prints the value of the floating-point value SUM where SUM is the results of the following series. SUM = 1/1! + 2/2! + 3/3! + 4/4! + ... N/N! Note that your program should print the message “Sorry, bad N”” if N is <=1, and keep reading user input until the user enters a valid value for N. Also, note that all division operations...
Need help figuring this out Write a program that reads in a sequence of numbers (doubles) from standard input until 0 is read, and stores them in an array, This part is done using iteration (loop). You may assume that the maximum size of the array will not be more than 100. Your program computes the maximum number stored in the array, the count of negative numbers, and computes the sum of positive numbers, using recursion. You need to have...