• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

Highest Value, Lowest and their difference

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
 
Marianne Hathaway
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
lowercase baba
Posts: 13091
67
Chrome Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
It is no measure of health to be well adjusted to a profoundly sick society. -Krishnamurti Tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic