Tuesday, November 16, 2010

How to determine the largest value using Java Programming

Same like last post I am going to post how to find the greatest value among few values by using simple Java program. Here we have taken three integer values as a= 300, b= 25, and c=5000. I will create a class name call largenumber and I will use 'if' and 'else'

First we have to check x > y. if this satisfies then check whether x > z or not. Again if this satisfies then write in the system class that x is greater. Again the term elsr comes when x is not greater than z. So check again if z is greater than y or not. If this satisfies then type in the system class as z is greater otherwise y is greater. Now check whether y is greater than z or not.

if x is not  greater than y as per the first condition then th condition else comes and now you have to check if y>z or not. If this satisfies then the output comes as y is greater.


No comments:

Post a Comment