How to resolve the algorithm Averages/Pythagorean means step by step in the PL/I programming language

Published on 12 May 2024 09:40 PM

How to resolve the algorithm Averages/Pythagorean means step by step in the PL/I programming language

Table of Contents

Problem Statement

Compute all three of the Pythagorean means of the set of integers 1 through 10 (inclusive). Show that

A (

x

1

, … ,

x

n

) ≥ G (

x

1

, … ,

x

n

) ≥ H (

x

1

, … ,

x

n

)

{\displaystyle A(x_{1},\ldots ,x_{n})\geq G(x_{1},\ldots ,x_{n})\geq H(x_{1},\ldots ,x_{n})}

for this set of positive integers.

Let's start with the solution:

Step by Step solution about How to resolve the algorithm Averages/Pythagorean means step by step in the PL/I programming language

Source code in the pl/i programming language

declare n fixed binary,
        (Average, Geometric, Harmonic) float;
declare A(10) float static initial (1,2,3,4,5,6,7,8,9,10);

n = hbound(A,1);

/* compute the average */
Average = sum(A)/n;

/* Compute the geometric mean: */
Geometric = prod(A)**(1/n);

/* Compute the Harmonic mean: */
Harmonic = n / sum(1/A);

put skip data (Average);
put skip data (Geometric);
put skip data (Harmonic);

if Average < Geometric then put skip list ('Error');
if Geometric < Harmonic then put skip list ('Error');

  

You may also check:How to resolve the algorithm Fibonacci sequence step by step in the Wart programming language
You may also check:How to resolve the algorithm String length step by step in the GW-BASIC programming language
You may also check:How to resolve the algorithm FASTA format step by step in the C programming language
You may also check:How to resolve the algorithm Gray code step by step in the BASIC programming language
You may also check:How to resolve the algorithm Bitmap/Bézier curves/Quadratic step by step in the FutureBasic programming language