IBM SC34-5764-01 Manual de usuario Pagina 91

  • Descarga
  • Añadir a mis manuales
  • Imprimir
  • Pagina
    / 481
  • Tabla de contenidos
  • MARCADORES
  • Valorado. / 5. Basado en revisión del cliente
Vista de pagina 90
/******************************* REXX ********************************/
/* This function receives a list of numbers, adds them, computes */
/* their average, and returns the average to the calling program. */
/*********************************************************************/
ARG numlist /* receive the numbers in a single variable */
sum = 0 /* initialize sum to zero */
DOn=1TOWORDS(numlist) /* Repeat for as many times as there */
/* are numbers */
number = WORD(numlist,n) /* Word #n goes to number */
sum = sum + number /* Sum increases by number */
END
average = sum / WORDS(numlist) /* Compute the average */
RETURN average
Figure 44. Possible Solution
Writing Subroutines and Functions
Chapter 6. Writing Subroutines and Functions 69
Vista de pagina 90
1 2 ... 86 87 88 89 90 91 92 93 94 95 96 ... 480 481

Comentarios a estos manuales

Sin comentarios