Input a list of positive numbers, terminated by 0, into an array Numbers. Then, display the array and the largest and smallest number in it.

Process, Input, Output information with variable names and type and complete pseudo code of the program (with declaration of variables, calling of modules, any modules, inputs, outputs, etc.)

This is what is being asked and I dont have a clue what to do. Can someone please help me. I would really appreciate it..

I guess this is it correct?

int[] Numbers;
Numbers = new int[50];
int K;
int Flag;
int Count;
int OneNumber;
int Temp;
String UserInput;
System. Console. WriteLine ("This program will sort 50 positive numbers for you");
System, Console. WriteLine ("The Program will show all numbers from smallest to highest and then display the lowest and highest number in the Array.
System. Console. WriteLine ("Enter your first positive number or enter a 0 to exit. ")
UserInput = System. Console. ReadLine;
OneNumber = int.Parse (UserInput);
Count = 0;
While (OneNumber = 0)
Numbers [Count] = OneNumber;
Count = Count + 1;
System. Console. WriteLine ("Enter another positive number or enter a 0 to exit.");
UserInput = System. Console. ReadLine;
OneNumber = int.Parse (UserInput);
Flag = 0;
While (Flag= 0)
Flag = 1;
For (K = 0; K = (Count - 2); K++)
If (Numbers [K] < Numbers [K + 1]
Temp = Numbers [K];
Numbers [K] = Numbers [K + 1];
Numbers [K + 1] = Temp;
Flag = 0;
System. Console. WriteLine ("Sorted List of Numbers);
For (K = 0; K <= (Count - 1); K+)
System. Console. WriteLine (Numbers [K])

Thank you

Recommended Answers

All 4 Replies

OK, I did it. Now it's your turn.

There it goes at the top

A. This is a C++ forum, your code looks like Java

B. Are you asking for help on the pseudocode, or the code

C. You appear to be sorting the array, which is not part of the problem statement you give. Well, it will work to find the smallest and largest values, which will be at the ends of the array. But it's easier done by just iterating one time through the array, keeping track of the largest and smallest values found.

I need help on the whole pseudocode.

Be a part of the DaniWeb community

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