473,387 Members | 1,486 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

How to find and print the lowest and highest numbers punched in by the user?

Hi, everyone. I'm trying to find the lowest and the highest numbers that a user has had punched in. The code includes a user punching in 4 different numbers, each on a different line. I need help figuring out how to display the highest and lowest number from the numbers the user typed in and then print them. This is suppose to a very basic code using selection structures and variables, but I can't figure it out. I'm not if I can use the 'if statement' to figure this out? I know this is pretty basic, but I'm at a loss. Can anyone help me get started with code? Thanks in advance.
Mar 26 '08 #1
4 2189
KevinADC
4,059 Expert 2GB
Same reply as on DevShed.
Mar 26 '08 #2
Ganon11
3,652 Expert 2GB
Build a list of the 4 values, then call sort {$a <=> $b} @the_numbers; This sorts the numbers in increasing order, and you can grab the first (smallest) element and the last (largest) element.
Mar 26 '08 #3
Kevin,

This time I won't post any code and ask the OP to try do some homework before posting anything.

Thanks,
Kalyan
Apr 1 '08 #4
KevinADC
4,059 Expert 2GB
Kevin,

This time I won't post any code and ask the OP to try do some homework before posting anything.

Thanks,
Kalyan

hehehe.... thanks. Too late as this is the same person, but next time...... ;)

On any forum where they could edit the post they removed the question. But on this forum you can't edit old posts so the question is still here.
Apr 1 '08 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Colin Graham | last post by:
Hi all, Basically ive built a vb .net app using a tab control for displaying and entering data. I originally hard coded this with the names of the various fields to have focus when i moved...
3
by: William Payne | last post by:
Hello, I'm working on a program where to user supplies a number of integers on the command line and then my program displays a list with all the integers, stating how many times each integer...
17
by: poison.summer | last post by:
Hi I have a char p, I'd like to print out the lower 4 bits and higher 4 bits of p seperately how can i do that? Thanks a lot!
16
by: Petrakid | last post by:
Hey, I have a task to complete. I am trying to figure out the best way, in C++ to determine the following. There is this farm with pigs and chickens. Only the legs of the pigs and chickens look...
3
by: lostncland | last post by:
I am working on this program. The array has 10 scores. (there is more to this program.) Does the last "for" section make sense? /*Defines a global constant called N throughout the file. ...
5
by: owz | last post by:
Hi again had some more problems, all help welcome. Access 2000, SQL My problem is as stated in the title. I want 2 display the highest and lowest priced car sold for this month. This is what I...
13
by: td0g03 | last post by:
Hello again guys. I have a question. I'm working on a program for my class and I'm stuck on how to find the lowest and highest number of a user input. We aren't at arrays yet so that's out of the...
6
by: fenners87 | last post by:
Hi I need to write a programme that asks users to enter 10 numbers and once the numbers have been entered i then need to sort them from lowest to highest in C# i.e 45, 3, 64, 6, 24, 75 ...
8
by: vince1266 | last post by:
I have a little bit of trouble finding the median in a list. I am trying to ask the user what his/her marks are and i am trying to find the median. I have a little bit of trouble because the user...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.