Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Basic Pseudocode (No particular language) You are given two arrays the first arr

ID: 3917938 • Letter: B

Question

Basic Pseudocode (No particular language)

You are given two arrays the first array contains the sports at a sporting event and the second array contains the number of athletes playing in each sport.

Use the arrays to design modules using pseudocode that will:

Calculate and print the number of athletes and sport name for all sports with less than 25 athletes.

Calculate and print the average number of athletes in all of the sports.

Print the number of athletes and sport name for the first sport with less than 25 athletes

Explanation / Answer

Assume that given two arrays are sports[],athlets[].

a) pseudo code for Calculate and print the number of athletes and sport name for all sports with less than 25 athletes.

1. n=sports.length();

2.for i=0 to n-1:

       if(athlets[i]<25):

                print(sports[i],athlets[i]);

b)pseudo code for Calculate and print the average number of athletes in all of the sports.

1.n=sports.length();

2.total=0;

3.for i=0 to n-1:

         total=total+athlets[i];

4. average=total/n;

5. print(average);

c) pseudo code for Print the number of athletes and sport name for the first sport with less than 25 athletes

1. n=sports.length();

2.for i=0 to n-1:

       if(athlets[i]<25):

                print(sports[i],athlets[i]);

                break;