0

Using javascript find greatest number among four number?number is given using if else

14th Jan 2017, 2:38 PM
kundan
kundan - avatar
2 Antworten
+ 3
document.write(Math.max(a, b, c, d))
14th Jan 2017, 2:38 PM
David Sebastian Keshvi Illiakis
David Sebastian Keshvi Illiakis - avatar
+ 1
<html> <head> <script> var a=5; var b=10; var c=17; var d=13; if(a>b) { if(a>c) { if(a>d) document.write(a); else document.write(d); } else { if(c>d) document.write(c); else document.write(d); } } else { if(b>c) { if(b>d) document.write(b); else document.write(d); } else { if(c>d) document.write(c); else document.write(d); } } </script> </head> <body> </body> </html>
14th Jan 2017, 2:56 PM
kundan
kundan - avatar