Write a C program that asks user for a series of numbers (enter
-99 to stop) and calculate the average of all the positive numbers
only.
solution:
#include <stdio.h> int main() { int num, total = 0, count = 0; while (1) { printf("Enter a number(-99 to stop): "); scanf("%d", &num); if (num == -99) break; if (num > 0) { total += num; count++; } } printf("Average of all positive numbers entered is %f\n", total/(float)count); return 0; }
please give me thumb up
Write a C program that asks user for a series of numbers (enter -99 to stop)...
Description: Write a program that asks the user to enter a series of numbers, and report the following: • The maximum number in the series • The minimum number in the series • The average of all positive numbers in the series The user will enter a pound key ‘#’ to stop the series. in Python
Design a program that asks the user to enter a series of 20 numbers. The program should store the numbers in the array and then display the following data: The lowest number in the array The highest number in the array The total of the number in the array The average of the numbers in the array PLEASE GIVE THE PSEUDOCODE AND CODE IN C PROGRAMMING
C++ Write a program that prompts the user to enter integers or a sentinel to stop. The program prints the highest and lowest numbers entered, the sum and the average. DO NOT USE ARRAYS, only variables and loops. Write a program the prompts the user to input a positive integer. Keep asking the user until a positive integer is entered. Once a positive integer is entered, print a message if the integer is prime or not. (NOTE: A number is...
Write a C program that asks the user to enter two real numbers. Then your program displays a menu that asks the user to choose what arithmetic operation to be done on those numbers. Depending on the user's entry, the program should display the result to the screen. The sample runs below show what should be done to the numbers entered by the user. Your program should run exactly like shown in the sample runs. make your code run as...
write a program code that asks the user how many numbers they wish to find the statistics of and then asks the user to enter those numbers. The program must then calculate and display the average variance and standard deviation of the numbers entered by the user. the program code must -ask three user how many numbers they wish to find the statistics of -ask the user to enter those numbers and store them in an array - use a...
Extra Credit Assignment 4 Write a PYTHON program that asks the user to enter a series of numbers. You can decide how many numbers to enter or the user can. As the user enters each number, add it to a list. After all the numbers are added, determine: What is the highest number in the list What is the lowest number in the list What is the sum of all the numbers in the list No error checking is required....
Using loops, write a C# program that asks the user to enter repeatedly an integer number, it stops when the user enters -1, then the program should display how many numbers were entered, their the sum and their average
Write a C++ program that does the following: Asks the user to enter 3 integers, Obtains the numbers from the user, Prints the largest number and then the smallest of the numbers, If the numbers are equal, prints the message: "These numbers are equal." Prints the sum, average, and product of the 3 numbers.
1. Write a program that asks the user to enter two integers, obtains the numbers from the user, then prints the larger number followed by the words “is larger.” If the numbers are equal, print the message “These numbers are equal.” Use only the single-selection form of the if statement you learned in this chapter.
In C++: Write a program that asks the user for an array of X numbers. Your program moves the largest number all the way to the right, and then shows it to the user. Hint: Use a loop to swap X times, but only swap if the number on the left is bigger than the number on the right. Sample Run: How many numbers would you like to enter? 6 Please enter number 1: 10 Please enter number 2: 8...