• Post Reply Bookmark Topic Watch Topic
  • New Topic

Highest Value, Lowest and their difference  RSS feed

 
Marianne Hathaway
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
Marianne Hathaway
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
the outputs highest and lowest values are fine.. but tere's something wrong in getting the difference.. I must get the difference of the highest number and the low numberS..
ex: numbers given: 1,2,3,4,5
The difference from the highest is:
[5-1]=4
[5-2]=3 <---how can i display them?
[5-3]=2
[5-4]=1

it's like that.. please help me.thanks
 
fred rosenberger
lowercase baba
Bartender
Posts: 12563
49
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The first step is to turn off your computer. Forget about java. forget about all programming languages, and think about the problem.

Pretend I was going to say a bunch of numbers out loud. When I was done, you have to tell me:

the largest
the smallest
the difference between the largest and smallest.

How would you do it? You are allowed to write down any number or numbers you want, you are allowed to do computations between me giving you each number, and you are allowed to erase numbers you have written down, and replace them with new numbers.

How would YOU do it?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!