Details of this Paper

Design the logic for a program that allows a user to enter 12 numbers

Description

solution


Question

Design the logic for a program that allows a user to enter 12 numbers, then displays each number and its difference from the numeric average of the numbers entered, using provided pseudocode.;start;Declarations;num index;num sum;num avg;num SIZE = 12;num numbers[SIZE] = 0,0,0,0,0,0,0,0,0,0;getReady();while index < SIZE;getNumbers();endwhile;finishUp();stop;getReady();index = 0;sum = 0;return;getNumbers();output ?Enter a number for position ?, index;input numbers[index];sum = sum + numbers[index];index = index + 1;return;finishUp();avg = sum/SIZE;index = 0;while index < SIZE;output numbers[index], avg ? numbers[index];index = index + 1;endwhile;return;Modify the program in Exercise 2a so that the user can enter any amount of numbers up to 12 until a sentinel value is entered.;start;Declarations;num index;num sum;num avg;num actualSize;num SIZE = 12;num numbers[SIZE] = 0;string CONTINUE = ?Y?;string moreNumbers = CONTINUE;getReady();while index 0 then;avg = sum/actualSize;index = 0;while index < actualSize;output numbers[index], avg ? numbers[index];index = index + 1;endwhile;endif;return

 

Paper#64307 | Written in 18-Jul-2015

Price : $27
SiteLock