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 5 Replies

You've probably been in a programming class for a few weeks, right? What have you learned so far and how do you think you could apply it to this assignment? Start with that, and post it if you get stuck. Then we may be willing to point you in a different direction if this is going to require something you haven't seen before.

I have posted what I have

Quit posting this nonsense in every forum. Stick to one posting.

1. Read number of positive numbers n
2.Create an array of size n as arr[n]
3.Let i=0,max=0,min=0
4.Repeat for i=0 to n-1
Read the number arr
If arr>max then
max=arr
End If
If i=0 then
min=arr
else
If arr<min then
min=arr
End If
End If
5.Repeat for i=0 to n-1
Print arr
6.Print max,min

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..

Thank you

You have been asked for pseudo code, what you have posted is C# code (i use the term loosely).
You need to focus on working out the flow of the program and the processes you need at each stage (ie, read in a number, store the number, sort array, find largest/smallest, output data).
The idea of using pseudocode is that you dont need to worry about language specific syntax/implementations and can concentrate on designing the most effective solution in terms of flow and structures.

What srrid.ajmal has given you is an example of what you should be producing.
Whilst there are no hard and fast rules (syntax rules would defeat the object of pseudocode) you should generally aim to write in plain english what you need to achieve at each step.

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.