PrintLargest

PrintLargest - double a = input.nextDouble();...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
import java.util.Scanner; public class PrintLargest { // a class to prompt the user // to enter two doubles // and print the largest / public static void main(String[]args) { p Scanner input=new Scanner(System.in); System.out.println("Enter a number");
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: double a = input.nextDouble(); System.out.println("Enter a different number:"); double b = input.nextDouble(); double max =(a>b)?a:b; System.out.println("The largest of the entered numbers is:"+max); S } }...
View Full Document

This document was uploaded on 04/14/2010.

Ask a homework question - tutors are online