IBM SC34-5764-01 Instrukcja Użytkownika Strona 91

  • Pobierz
  • Dodaj do moich podręczników
  • Drukuj
  • Strona
    / 481
  • Spis treści
  • BOOKMARKI
  • Oceniono. / 5. Na podstawie oceny klientów
Przeglądanie stron 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
Przeglądanie stron 90
1 2 ... 86 87 88 89 90 91 92 93 94 95 96 ... 480 481

Komentarze do niniejszej Instrukcji

Brak uwag