Computer Science, asked by thirukumaran992005, 6 hours ago

Write a program to accept three numbers and find the biggest number using nested if statement

Answers

Answered by qureshnihal
0

Answer:

Stack Overflow

Sign up

Log in

Questions Jobs Tags Users Badges Ask

Up vote

-1

Down vote

How to do nested if - else with 4 numbers to find biggest number

java class if-statement numbers nested-if

public class NastingIfElse {

public static void main(String[] args) {

int a = 998 , b = 857 , c = 241 , d = 153;

int result;

if ( a > b ) {

if ( a > c ) {

if ( a > d ) {

result = a;

}else {

result = d;

}

}

}

if ( b > c ) {

if ( b > d ) {

result = b;

}else {

result = d;

}

}

if ( c > a ) {

if ( c > d ) {

result = c;

}else {

result = d;

}

}

if ( d > a ) {

if ( d > c ) {

if ( d > b ) {

result = d;

}else {

result = b;

}

}

}

Similar questions