Question

1 Design an algorithm that will read a series of 50 integers at the terminal. The first integer is special, as it indicates h

Can I please have a simple pseudocode algorithm of this problem.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

The algorithm for finding sum and average of atmost 50 integers from terminal is given below.

START -:       numberCount = 0         runningTotal = 0        Read first number as totalNum   While numberCount is less than totalNum                 Read inputNum           numberCount=numberCount+1               runningTotal=runningTotal+inputNum      End     Print runningTotal      If numberCount > 0    averageValue = runningTotal / numberCount       Print averageValue     Else     Print "Cannot calculate average" END

START -: numberCount = 0 runningTotal = 0 Read first number as totalNum While numberCount is less than totalNum Read inputNum

Please dont forget to upvote if you like the solution.

Add a comment
Know the answer?
Add Answer to:
Can I please have a simple pseudocode algorithm of this problem. 1 Design an algorithm that...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Part I Short Answer (50 points) 1. Write a pseudocode declaration for a String array initialized...

    Part I Short Answer (50 points) 1. Write a pseudocode declaration for a String array initialized with the following strings: “Einstein”, “Newton”, “Copernicus”, and “Kepler”. 2. Assume names in an Integer array with 20 elements. Write a pseudocode algorithm a For Loop that displays each element of the array. 3. Assume the arrays numberArray1 and numberArray2 each have 100 elements. Write a pseudocode algorithm that copies the values in numberArray1 to numberArray2 . 4. Write a pseudocode algorithm for a...

  • Please complete in pseudocode. No language. Create the pseudocode design to include at least the following...

    Please complete in pseudocode. No language. Create the pseudocode design to include at least the following modules. Enter the ClassTitle into an array named Classes and NumberofSeats into an array named ClassSeats.   (ClassSeats =   -999 when end the file is reached) Update Classes inventory (add to inventory/deduct from inventory) Calculate and print the student’s bill. Calculate and print the total number of students in each class. Calculate and print the average number of students in each class. The student will...

  • PLEASE DO IN PYTHON Program 2: Design (pseudocode) and implement (source code) a program (name it...

    PLEASE DO IN PYTHON Program 2: Design (pseudocode) and implement (source code) a program (name it FeetMeters) to display a conversion tables for feet and meter as show below. Document your code and properly. Feet Meter 1.0 0.305 2.0 0.610 3.0 0.915 . . . . . . 19.0 5.7.95 20.0 6.100 Meter Feet 1.0 3.279 2.0 6.558 3.0 9.837 . . . . . . 19.0 62.301 20.0 65.574 The program defines the following methods: Method feetToMeter() converts from...

  • Python 3.7 to be used. Just a simple design a program that depends on its own. You should also not need to import anythi...

    Python 3.7 to be used. Just a simple design a program that depends on its own. You should also not need to import anything. No code outside of a function! Median List Traversal and Exception Handling Create a menu-driven program that will accept a collection of non-negative integers from the keyboard, calculate the mean and median values and display those values on the screen. Your menu should have 6 options 50% below 50% above Add a number to the list/array...

  • PLEASE DO THE PSEUDOCODE FOR THE PROGRAM BELOW Program 3: Design (pseudocode) and implement (source code)...

    PLEASE DO THE PSEUDOCODE FOR THE PROGRAM BELOW Program 3: Design (pseudocode) and implement (source code) a program (name it DistinctValues) to display only district values in an array. The program main method defines a single-dimensional array of size 10 elements and prompts the user to enter 10 integers to initialize the array. The main method then calls method getValues() that takes an integer array and returns another single-dimensional array containing only distinct values in the original (passed) array. Document...

  • Problem: Design and write a C language program that can be used to calculate Voltage, Current...

    Problem: Design and write a C language program that can be used to calculate Voltage, Current and Total Resistance for a Series or Parallel or a Series Parallel circuit. The program should display the main menu that contains the three types of circuit calculations that are available and then the user will be prompted to select a circuit first. After the circuit has been selected the program should then display another menu (i.e., a submenu) requesting the necessary data for...

  • Hi, I need help with this practice problem! Chapter 2 Algorithm Discovery and Design 64C FIGURE...

    Hi, I need help with this practice problem! Chapter 2 Algorithm Discovery and Design 64C FIGURE 2.10 Get values for a and b If (either a 0orb 0) then Set the value of product to o se Set the value of count to 0 Set the value of product to 0 While (count <b) do Set the value of product to (product+ a) Set the value of count to (count + 1) End of loop Print the value of product...

  • Can you please Test and debug the program below using the following specifications? Many thanks! Create...

    Can you please Test and debug the program below using the following specifications? Many thanks! Create a list of valid entries and the correct results for each set of entries. Then, make sure that the results are correct when you test with these entries. Create a list of invalid entries. These should include entries that test the limits of the allowable values. Then, handle the invalid integers (such as negative integers and unreasonably large integers). In addition, make sure the...

  • in JAVA please thanks. (need answer in a few hours !!) Exercise #1: Design and implement...

    in JAVA please thanks. (need answer in a few hours !!) Exercise #1: Design and implement a program (name it LinearBinarySearch) to implement and test the linear and binary search algorithm discussed in the lecture slides. Define method LinearSearch() to implement linear search of an array of integers. Modify the algorithm implementation to count number of comparisons it takes to find a target value (if exist) in the array. Define method BinarySearch() to implement binary search of an array of...

  • please write down the code Thank you. Write a simple shell that is similar to this: while(1 //repeat forever //display prompt on screen type_prompt )i read_command ( command, parameters); // read inp...

    please write down the code Thank you. Write a simple shell that is similar to this: while(1 //repeat forever //display prompt on screen type_prompt )i read_command ( command, parameters); // read input from terminal if ( fork) 0) // parent //wait for child wait NULL elset execve (commamd, parameters, 0 // execute command but contains enough code that it actually works so you can test it. For simplicity, you may assume that all commands are in the directory /bin Write...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT