PrintAverage

PrintAverage - System.out.println("Enter a...

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 PrintAverage { // a class to prompt the user // to enter three doubles // and print their average public static void main(String []args) { p Scanner input=new Scanner(System.in); System.out.println("Enter a number:"); double a = input.nextDouble();
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: System.out.println("Enter a different number:"); double b = input.nextDouble(); System.out.println("Enter another number:"); double c = input.nextDouble(); System.out.println("The average of the 3 entered numbers is:"+(a+b+c)/3); S } }...
View Full Document

Ask a homework question - tutors are online