I'm trying to design a program that will input ages of 50 active duty Navy personnel and then finds the average age of current active duty Navy members. Here is my current pseudocode, could anyone tell me if there are errors?

Declare age[50] as integer
Declare Sum, Average as float
Declare I as integer
Set Sum = 0
For (I = 0; I < 50; I++)
Write “Enter age of Active Duty Navy personnel” (I+1)
Input Age[I]
Set sum = sum + Age[I]
End For
Set Average = Sum/50
For (I = 0; I < 50; I++)
Write “Age of User” + (I+1) + “ is “ Age[I]
End For
Write “The current average age of Active Duty navy personnel is ” + Average

Seems fine. Although you might want to Make a const MAX_NUM_OF_NAVY
then use that where ever you need it.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.